chore: clean up code

This commit is contained in:
Chris Kruining 2025-12-11 08:32:28 +01:00
parent 7751f756b7
commit ddf66697cb
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
3 changed files with 6 additions and 7 deletions

View file

@ -8,4 +8,4 @@
[no-exit-message]
@update machine:
just assert '-d "../systems/x86_64-linux/{{ machine }}"' "Machine {{ machine }} does not exist, must be one of: $(ls ../systems/x86_64-linux/ | sed ':a;N;$!ba;s/\n/, /g')"
nixos-rebuild switch -L --use-remote-sudo --target-host {{ machine }} --flake ..#{{ machine }}
nixos-rebuild switch -L --sudo --target-host {{ machine }} --flake ..#{{ machine }}

View file

@ -1,4 +1,5 @@
set unstable := true
set quiet := true
base_path := invocation_directory() / "systems/x86_64-linux"
@ -8,14 +9,14 @@ base_path := invocation_directory() / "systems/x86_64-linux"
sops := "sops"
yq := "yq"
@_default:
_default:
just --list
[doc('list all vars of the target machine')]
list machine:
sops decrypt {{ base_path }}/{{ machine }}/secrets.yml
@edit machine:
edit machine:
sops edit {{ base_path }}/{{ machine }}/secrets.yml
@set machine key value:
@ -26,10 +27,10 @@ list machine:
echo "Done"
@get machine key:
get machine key:
sops decrypt {{ base_path }}/{{ machine }}/secrets.yml | yq ".$(echo "{{ key }}" | sed -E 's/\//./g')"
@remove machine key:
remove machine key:
sops unset {{ base_path }}/{{ machine }}/secrets.yml "$(printf '%s\n' '["{{ key }}"]' | sed -E 's#/#"]["#g; s/\["([0-9]+)"\]/[\1]/g')"
git add {{ base_path }}/{{ machine }}/secrets.yml