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
Truxnell 1554768917
Feat: containers and helios join the party (#79)
* feat: add

* hack

* feat: add secrets pre-commit

* wip

* wip

* hacking at gatus

* hacking at gatus

* wip

* wip

* hack

* hack

* hack

* hack

* feat: gatus doing gatus stuff

* hack

* guh

* hacking

* hack

* hack

* hack

* feat: add helios

* hack

* chore: new hosts reencrypt

* Auto lint/format

---------

Co-authored-by: Truxnell <9149206+truxnell@users.noreply.github.com>
Co-authored-by: truxnell <truxnell@users.noreply.github.com>
2024-04-10 18:00:25 +10:00

121 lines
2.9 KiB
YAML

---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
hostname: $HOSTNAME
host: '{{ or .host .hostname }}'
tasks:
switch:
desc: Build and apply nix configuration
silent: true
requires:
vars:
- host
cmds:
- echo "This will switch your config."
- task: .prompt_to_continue
- git add .
- sudo nixos-rebuild switch --flake "{{.ROOT_DIR}}/#{{.hostname}}" --impure
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"
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 and add your untracked git files."
- git add .
- 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
requires:
vars:
- host
cmds:
- git add .
- nixos-rebuild build --flake "{{.ROOT_DIR}}/#{{.host}}" --impure --fast
- nvd diff /run/current-system result
preconditions:
- sh: which nix
msg: "nix not found"
- sh: which nixos-rebuild
msg: "nixos-rebuild not found"
- sh: which nvd
msg: "nvd not found"
.prompt_to_continue:
internal: true
prompt: Do you want to continue applying this configuration?
build-image-rpi4:
desc: Build basic machine build-image
silent: true
cmds:
- nix build .#images.rpi4