feat: flesh out nix tasks

This commit is contained in:
Truxnell 2024-03-25 17:06:14 +11:00
parent 3416303a07
commit 787fd6fee2

View file

@ -5,16 +5,14 @@ vars:
host: $HOSTNAME
tasks:
apply:
switch:
desc: Build and apply nix configuration
silent: true
requires:
vars:
- host
cmds:
- task: build
vars:
host: "{{ .host }}"
- echo "This will switch your config."
- task: .prompt_to_continue
- sudo nixos-rebuild switch --flake "{{.ROOT_DIR}}/#{{.host}}" --impure
preconditions:
@ -23,6 +21,38 @@ tasks:
- sh: which nixos-rebuild
msg: "nixos-rebuild not found"
test:
desc: Build and apply nix configuration
silent: true
requires:
vars:
- host
cmds:
- echo "This will test your config."
- task: .prompt_to_continue
- sudo nixos-rebuild test --flake "{{.ROOT_DIR}}/#{{.host}}" --impure
preconditions:
- sh: which nix
msg: "nix not found"
- sh: which nixos-rebuild
msg: "nixos-rebuild not found"
dry-run:
desc: Build and apply nix configuration
silent: true
requires:
vars:
- host
cmds:
- echo "This will dry-run your config."
- nixos-rebuild dry-run --flake "{{.ROOT_DIR}}/#{{.host}}" --impure
preconditions:
- sh: which nix
msg: "nix not found"
- sh: which nixos-rebuild
msg: "nixos-rebuild not found"
build:
desc: Build nix configuration
silent: true
@ -31,7 +61,6 @@ tasks:
- host
cmds:
- nixos-rebuild build --flake "{{.ROOT_DIR}}/#{{.host}}" --impure
- nvd diff /run/current-system result
preconditions:
- sh: which nix
msg: "nix not found"