diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index 237025c..082a8e5 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -4,6 +4,7 @@ {{- $shell := promptBoolOnce . "features.shell" "Do you want to install the Fish shell" true }} {{- $git := promptBoolOnce . "features.git" "Do you want to install Git" true }} {{- $editor := promptBoolOnce . "features.editor" "Do you want to install Neovim" true }} +{{- $nix := promptBoolOnce . "features.editor" "Do you want to install the Nix package manager" true }} [data] email = {{ $email | quote }} @@ -13,3 +14,4 @@ git_name = {{ $git_name | quote }} shell = {{ $shell }} git = {{ $git }} editor = {{ $editor }} +nix = {{ $nix }} diff --git a/home/.chezmoiignore.tmpl b/home/.chezmoiignore.tmpl index 9eabcac..b503499 100644 --- a/home/.chezmoiignore.tmpl +++ b/home/.chezmoiignore.tmpl @@ -10,3 +10,7 @@ {{- if not .features.editor }} .config/nvim {{- end }} + +{{- if not .features.nix }} +.config/nix +{{- end }} diff --git a/home/private_dot_config/fish/conf.d/aliases.fish.tmpl b/home/private_dot_config/fish/conf.d/aliases.fish.tmpl index 03139d6..c9d6c83 100644 --- a/home/private_dot_config/fish/conf.d/aliases.fish.tmpl +++ b/home/private_dot_config/fish/conf.d/aliases.fish.tmpl @@ -5,3 +5,7 @@ abbr --add --position command l ls -lAh abbr --add --position command vim nvim abbr --add --position command vi nvim {{- end }} + +{{- if .features.nix }} +abbr --add --position command nd 'nix develop --command $SHELL' +{{- end }} diff --git a/home/private_dot_config/nix/nix.conf b/home/private_dot_config/nix/nix.conf new file mode 100644 index 0000000..f22f1fd --- /dev/null +++ b/home/private_dot_config/nix/nix.conf @@ -0,0 +1,2 @@ +# Enable Nix flakes +experimental-features = nix-command flakes diff --git a/setup-script/playbook.yaml b/setup-script/playbook.yaml index 28a18de..c1c70f1 100644 --- a/setup-script/playbook.yaml +++ b/setup-script/playbook.yaml @@ -29,3 +29,5 @@ when: features.git == true - role: editor when: features.editor == true + - role: nix + when: features.nix == true diff --git a/setup-script/roles/nix/tasks/main.yml b/setup-script/roles/nix/tasks/main.yml new file mode 100644 index 0000000..25c6cac --- /dev/null +++ b/setup-script/roles/nix/tasks/main.yml @@ -0,0 +1,12 @@ +- name: Install Nix on Arch + become: true + ansible.builtin.pacman: + name: nix + when: chezmoi.osRelease.id == "arch" + +- name: Start the Nix daemon + become: true + ansible.builtin.systemd_service: + name: nix-daemon + enabled: true + state: started