This repository has been archived on 2024-07-08. You can view files and clone it, but cannot push or open issues or pull requests.
nix-config-tn/.taskfiles/nix/Taskfile.yaml

122 lines
2.9 KiB
YAML
Raw Normal View History

2024-03-17 21:44:51 +11:00
---
2024-03-25 20:12:45 +11:00
# yaml-language-server: $schema=https://taskfile.dev/schema.json
2024-03-17 21:44:51 +11:00
version: "3"
vars:
hostname: $HOSTNAME
host: '{{ or .host .hostname }}'
2024-03-17 21:44:51 +11:00
tasks:
2024-03-25 17:06:14 +11:00
switch:
2024-03-17 21:44:51 +11:00
desc: Build and apply nix configuration
silent: true
requires:
vars:
- host
cmds:
2024-03-25 17:06:14 +11:00
- echo "This will switch your config."
2024-03-17 21:44:51 +11:00
- task: .prompt_to_continue
2024-03-31 15:02:26 +11:00
- git add .
- sudo nixos-rebuild switch --flake "{{.ROOT_DIR}}/#{{.hostname}}" --impure
2024-03-17 21:44:51 +11:00
preconditions:
- sh: which nix
msg: "nix not found"
- sh: which nixos-rebuild
msg: "nixos-rebuild not found"
deploy-single:
desc: Deploy flake to single node
# silent: true
requires:
vars:
- host
cmds:
- echo "This will deploy the local flake to host {{ .host }}."
- task: .prompt_to_continue
- .taskfiles/nix/update-single-machine.sh {{.host}}
preconditions:
- sh: which nix
msg: "nix not found"
- sh: which nixos-rebuild
msg: "nixos-rebuild not found"
deploy-all:
desc: Deploy flake to all nodes
# silent: true
requires:
vars:
- host
cmds:
- echo "This will deploy the local flake to all whitelisted hosts."
- task: .prompt_to_continue
- .taskfiles/nix/update-all.sh
preconditions:
- sh: which nix
msg: "nix not found"
- sh: which nixos-rebuild
msg: "nixos-rebuild not found"
2024-03-17 21:44:51 +11:00
2024-03-25 17:06:14 +11:00
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:
2024-03-26 21:11:56 +11:00
- echo "This will dry-run your config and add your untracked git files."
- git add .
2024-03-25 17:06:14 +11:00
- 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"
2024-03-17 21:44:51 +11:00
build:
desc: Build nix configuration
silent: true
requires:
vars:
- host
cmds:
2024-03-26 21:11:56 +11:00
- git add .
- nixos-rebuild build --flake "{{.ROOT_DIR}}/#{{.host}}" --impure --fast
2024-03-26 21:11:56 +11:00
- nvd diff /run/current-system result
2024-03-17 21:44:51 +11:00
preconditions:
- sh: which nix
msg: "nix not found"
- sh: which nixos-rebuild
msg: "nixos-rebuild not found"
- sh: which nvd
msg: "nvd not found"
2024-03-18 07:42:52 +11:00
2024-03-17 21:44:51 +11:00
.prompt_to_continue:
internal: true
2024-03-18 07:42:52 +11:00
prompt: Do you want to continue applying this configuration?
2024-03-19 08:16:39 +11:00
build-image-rpi4:
desc: Build basic machine build-image
silent: true
cmds:
- nix build .#images.rpi4