Skip to content

Commit

Permalink
add nvm
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwn committed Sep 11, 2024
1 parent 54fb276 commit 4a393db
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
3 changes: 3 additions & 0 deletions roles/nvm/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- preinstall
23 changes: 23 additions & 0 deletions roles/nvm/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: Download install script
ansible.builtin.get_url:
url: "https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh"
dest: "{{ ansible_env.HOME }}/install/nvm_install.sh"
mode: a+x

- name: Run install script
ansible.builtin.command:
chdir: "{{ ansible_env.HOME }}/install"
cmd: bash nvm_install.sh
args:
creates: "{{ ansible_env.HOME }}/.config/nvm/nvm.sh"
environment:
XDG_CONFIG_HOME: "{{ ansible_env.HOME }}/.config"

- name: Make nvm available in zsh
ansible.builtin.blockinfile:
path: "{{ ansible_env.HOME }}/.config/zsh/ansible.zsh"
marker: "# {mark} NVM"
block: |
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
12 changes: 3 additions & 9 deletions ubuntu24.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
- env.yml
vars:
integration_testing: false
single_tool: ""
environment: "{{ env }}"

gather_facts: true
Expand Down Expand Up @@ -39,27 +38,22 @@
- role: nerd_fonts
vars:
nerd_fonts_fonts:
- "ComicShannsMono"
- "JetBrainsMono"
when: ansible_facts["virtualization_role"] == "guest" or integration_testing

- role: delta
when: single_tool == "delta" or integration_testing
- role: hugo
when: single_tool == "hugo" or integration_testing
- role: hyperfine
when: single_tool == "hyperfine" or integration_testing
- role: pandoc
when: single_tool == "pandoc" or integration_testing
- role: vivid
when: single_tool == "vivid" or integration_testing
- role: nvm

tasks:
- name: Install optional packages for host machine
become: true
ansible.builtin.apt:
name:
- pandoc
when: ansible_facts["virtualization_role"] != "guest"
when: '"WSL" not in ansible_facts["kernel"]'

- name: Install optional packages for guest machine
ansible.builtin.import_role:
Expand Down

0 comments on commit 4a393db

Please sign in to comment.