diff --git a/Dockerfile b/Dockerfile index 201e69d..32afa77 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ RUN apt update && apt -y install software-properties-common && add-apt-repositor # run Ansible commands COPY ./requirements.yaml ./playbook.yaml ./ -RUN ansible-galaxy install -r requirements.yaml && ansible-playbook -i,localhost playbook.yaml --tags "all" && rm -f ./*.yaml +RUN ansible-galaxy install -r requirements.yaml && ansible-playbook -vvvv -i,localhost playbook.yaml --tags "install_utilities" && rm -f ./*.yaml # Custom Desktop Background - replace bg_custom.png on disk with your own background image COPY ./bg_fairy_penguins_1600x800.png /usr/share/backgrounds/bg_default.png diff --git a/install_files/nix-root-profile.sh b/install_files/nix-root-profile.sh new file mode 100644 index 0000000..b0ae655 --- /dev/null +++ b/install_files/nix-root-profile.sh @@ -0,0 +1,5 @@ +#!/usr/bin/bash +# Add Nix root profile to the system PATH +if [ -d /nix/var/nix/profiles/per-user/root/bin ]; then + export PATH="/nix/var/nix/profiles/per-user/root/bin:$PATH" +fi diff --git a/playbook.yaml b/playbook.yaml index 7f7ee61..8d9f490 100644 --- a/playbook.yaml +++ b/playbook.yaml @@ -78,98 +78,106 @@ - role: webarchitect609.google_chrome - - # install firefox + # install keychain, git, nix, and @capsulecorplab .vimrc and .gitconfig hosts: localhost connection: local gather_facts: yes tags: - - install_firefox - - vars: - firefox_profiles: - default: - extensions: - - ublock-origin - preferences: - network.cookie.cookieBehavior: 1 - privacy.donottrackheader.enabled: true - datareporting.healthreport.uploadEnabled: false - secondprofile: - extensions: - - adblock-plus - preferences: - privacy.donottrackheader.enabled: false - privacy.trackingprotection.enabled: false - signon.rememberSignons: false - datareporting.healthreport.uploadEnabled: false - - tasks: - - name: Get disk usage - shell: df -h - register: disk_usage - - name: Display disk usage - debug: - msg: "{{ disk_usage.stdout }}" - - pre_tasks: - - name: Update apt packages - apt: - update_cache: yes - - roles: - - role: staticdev.firefox - -- - # install keychain, git, and @capsulecorplab .vimrc and .gitconfig - hosts: localhost - connection: local - gather_facts: yes - tags: install_utilities + - install_utilities + - install_python_packages vars: + nixos_release: "26.05" + nix_version: "2.35.3" + nix_installer_dir: /tmp/nix-{{ nix_version }}-x86_64-linux git_version: "2.43.0" - git_version_to_install: "1:{{ git_version }}-1ubuntu7" keychain_version: "2.8.5" - keychain_version_to_install: "{{ keychain_version }}-4" keychain_version_expected: "{{ keychain_version }}.." tasks: - - name: Add git PPA - shell: add-apt-repository ppa:git-core/ppa - - name: Install git + # - name: Install nix-bin # see https://moonpiedumplings.github.io/projects/setting-up-kasm/#customized-kasm-images + # apt: + # name: nix-bin + # update_cache: yes + # - name: Create {{ nix_install_dir }} directory with chmod 755 + # file: + # path: "{{ nix_install_dir }}" + # state: directory + # mode: '0755' + - name: Create /nix directory with chmod 755 + file: + path: /nix + state: directory + mode: '0755' + - name: Install build dependencies apt: - name: git - - name: Install Git Bash Completion - apt: - name: bash-completion - update_cache: yes - - name: Install Keychain - apt: - name: "keychain={{ keychain_version_to_install }}" + name: + - xz-utils # unpacks binary tarball + - build-essential # gcc, make, etc. + - libssl-dev # for OpenSSL + - ca-certificates update_cache: yes - - name: install ping + - name: Install Sudo apt: - name: iputils-ping + name: sudo update_cache: yes - - name: Get git version - shell: git version | sed 's/[[:alpha:]|(|[:space:]]//g' - register: installed_git_version - - name: Get keychain version + - name: Download nix tarball {{ nix_version }} + shell: curl -L https://releases.nixos.org/nix/nix-{{ nix_version }}/nix-{{ nix_version }}-x86\_64-linux.tar.xz -o {{ nix_installer_dir }}.tar.xz + - name: Extract nix tarball to /tmp shell: - cmd: keychain -V 2> >(grep -i keychain) 2> >(sed 's/[[:alpha:]|(|[:space:]]//g') | fgrep '*' | sed 's/[*~://]//g' + cmd: "tar -xvf {{ nix_installer_dir }}.tar.xz" + chdir: /tmp executable: /bin/bash - register: installed_keychain_version - - name: Display git and keychain versions - debug: - msg: "git = {{ installed_git_version.stdout }} | keychain = {{ installed_keychain_version.stdout }}" - - name: Test git version - fail: - msg: "Git Version Error: Expected {{ git_version }} | Found {{ installed_git_version.stdout }}" - when: installed_git_version.stdout != git_version - - name: Test keychain version - fail: - msg: "Keychain Version Error: Expected {{ keychain_version_expected }} | Found {{ installed_keychain_version.stdout }}" - when: installed_keychain_version.stdout != keychain_version_expected + args: + creates: "{{ nix_installer_dir }}/install" + - name: Install (single-user) nix using classic nix installer with --fallback (i.e., build from source to dynamically pull OpenSSL version) + shell: + cmd: ./install --no-daemon --fallback + chdir: "{{ nix_installer_dir }}" + executable: /bin/bash + # - name: Add kasm-user to nix-users group + # shell: usermod -aG nix-users kasm-user + # - name: Remove existing /nix/var/nix/profiles/per-user/root directory + # shell: rm -rf /nix/var/nix/profiles/per-user/root + # - name: Create temporary first-generation directory + # shell: mkdir -p /nix/var/nix/profiles/per-user/root-gen-0 + # - name: Symlink /nix/var/nix/profiles/per-user/root to /nix/var/nix/profiles/per-user/root-gen-0 + # shell: ln -sfn /nix/var/nix/profiles/per-user/root-gen-0 /nix/var/nix/profiles/per-user/root + # - name: Copy script for exporting nix root profile to path to /etc/profile.d/nix-root-profile.sh + # copy: + # src: /home/kasm-default-profile/install_files/nix-root-profile.sh + # dest: /etc/profile.d/nix-root-profile.sh + # remote_src: yes + # owner: root + # group: root + # mode: '0755' + # - name: Install git {{ git_version }} with nix + # shell: nix profile install nixpkgs/release-{{ nixos_release }}#git --extra-experimental-features 'nix-command flakes' --profile /nix/var/nix/profiles/per-user/root + # - name: Install Git Bash Completion + # shell: nix profile install nixpkgs/release-{{ nixos_release }}#bash-completion --extra-experimental-features 'nix-command flakes' --profile /nix/var/nix/profiles/per-user/root + # - name: Install Keychain + # shell: nix profile install nixpkgs/release-{{ nixos_release }}#keychain --extra-experimental-features 'nix-command flakes' --profile /nix/var/nix/profiles/per-user/root + # - name: install ping + # shell: nix profile install nixpkgs#unixtools.ping --extra-experimental-features 'nix-command flakes' --profile /nix/var/nix/profiles/per-user/root + # - name: Get keychain version + # shell: + # cmd: keychain -V 2> >(grep -i keychain) 2> >(sed 's/[[:alpha:]|(|[:space:]]//g') | fgrep '*' | sed 's/[*~://]//g' + # executable: /bin/bash + # register: installed_keychain_version + # - name: Get git version + # shell: git version | sed 's/[[:alpha:]|(|[:space:]]//g' + # register: installed_git_version + # - name: Display git and keychain versions + # debug: + # msg: "git = {{ installed_git_version.stdout }} | keychain = {{ installed_keychain_version.stdout }}" + # - name: Test git version + # fail: + # msg: "Git Version Error: Expected {{ git_version }} | Found {{ installed_git_version.stdout }}" + # when: installed_git_version.stdout != git_version + #- name: Test keychain version + # fail: + # msg: "Keychain Version Error: Expected {{ keychain_version_expected }} | Found {{ installed_keychain_version.stdout }}" + # when: installed_keychain_version.stdout != keychain_version_expected - name: Install @capsulecorplab .vimrc get_url: url: https://gist.githubusercontent.com/capsulecorplab/495058e7a57ed8adaed3c40c80d09739/raw/4a6e6f6ff92b96919be111c9cbb5a4a21ab472d2/.vimrc @@ -190,6 +198,8 @@ hosts: localhost connection: local gather_facts: yes + tags: + - install_python_packages tasks: - name: Update OS to point python to python3 @@ -205,6 +215,10 @@ break_system_packages: true name: - pint + - voila + - notebook==6.5.7 + - jupyterlab==3.6.8 + extra_args: --ignore-installed - name: Get disk usage shell: df -h register: disk_usage @@ -369,12 +383,13 @@ roles: - role: gantsign.visual-studio-code + visual_studio_code_version: "1.91.1*" users: - username: "dev" visual_studio_code_extensions: - ms-python.python - dendron.dendron - - foam.foam-vscode + #- foam.foam-vscode visual_studio_code_settings_overwrite: yes visual_studio_code_settings: { "extensions.ignoreRecommendations": true, diff --git a/requirements.yaml b/requirements.yaml index 46d4674..d33accb 100644 --- a/requirements.yaml +++ b/requirements.yaml @@ -3,6 +3,5 @@ - irixjp.role_example_hello # https://galaxy.ansible.com/irixjp/role_example_hello - grzegorznowak.nvm_node # https://galaxy.ansible.com/grzegorznowak/nvm_node - webarchitect609.google_chrome # https://galaxy.ansible.com/webarchitect609/google_chrome -- staticdev.firefox # https://galaxy.ansible.com/staticdev/firefox - gantsign.visual-studio-code # https://galaxy.ansible.com/gantsign/visual-studio-code ...