From 787fd6fee2655bf4fc88f3b9eb476c6eaac4e84c Mon Sep 17 00:00:00 2001 From: Truxnell <9149206+truxnell@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:06:14 +1100 Subject: [PATCH] feat: flesh out nix tasks --- .taskfiles/nix/Taskfile.yaml | 39 +++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/.taskfiles/nix/Taskfile.yaml b/.taskfiles/nix/Taskfile.yaml index a0cd6e4..fdbb466 100644 --- a/.taskfiles/nix/Taskfile.yaml +++ b/.taskfiles/nix/Taskfile.yaml @@ -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"