feat: add basic taskfiles
This commit is contained in:
parent
ff8f904cf1
commit
b238e6c860
3 changed files with 78 additions and 0 deletions
45
.taskfiles/nix/Taskfile.yaml
Normal file
45
.taskfiles/nix/Taskfile.yaml
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
host: $HOSTNAME
|
||||
|
||||
tasks:
|
||||
apply:
|
||||
desc: Build and apply nix configuration
|
||||
silent: true
|
||||
requires:
|
||||
vars:
|
||||
- host
|
||||
cmds:
|
||||
- task: build
|
||||
vars:
|
||||
host: "{{ .host }}"
|
||||
- task: .prompt_to_continue
|
||||
- sudo nixos-rebuild switch --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:
|
||||
- nixos-rebuild build --flake "{{.ROOT_DIR}}/#{{.host}}" --impure
|
||||
- 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?
|
17
.taskfiles/sops/Taskfile.yaml
Normal file
17
.taskfiles/sops/Taskfile.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
version: "3"
|
||||
|
||||
tasks:
|
||||
re-encrypt:
|
||||
desc: Decrypt and re-encrypt all sops secrets
|
||||
silent: true
|
||||
dir: "{{.USER_WORKING_DIR}}"
|
||||
vars:
|
||||
SECRET_FILES:
|
||||
sh: find . -type f -name '*.sops.yaml' ! -name ".sops.yaml"
|
||||
cmds:
|
||||
- for: { var: SECRET_FILES }
|
||||
cmd: |
|
||||
echo "Re-encrypting {{ .ITEM }}"
|
||||
sops --decrypt --in-place "{{ .ITEM }}"
|
||||
sops --encrypt --in-place "{{ .ITEM }}"
|
16
Taskfile.yaml
Normal file
16
Taskfile.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
version: "3"
|
||||
|
||||
includes:
|
||||
sops:
|
||||
taskfile: ".taskfiles/sops"
|
||||
dir: .taskfiles/sops
|
||||
nix:
|
||||
taskfile: ".taskfiles/nix"
|
||||
dir: "{{.ROOT_DIR}}"
|
||||
|
||||
tasks:
|
||||
default:
|
||||
silent: true
|
||||
cmds:
|
||||
- task -l
|
Reference in a new issue