fix: use nom without building twice

This commit is contained in:
Nickolaj Jepsen 2025-03-09 19:19:03 +01:00
parent 757a2540ab
commit bcc43b1da4

View file

@ -1,6 +1,7 @@
# export NIXPKGS_ALLOW_UNFREE := "1" # export NIXPKGS_ALLOW_UNFREE := "1"
nixcmd := "nix --experimental-features 'nix-command flakes'" nixcmd := "nix --experimental-features 'nix-command flakes'"
nix_output_monitor := "--log-format internal-json |& nix --experimental-features 'nix-command flakes' run nixpkgs#nix-output-monitor -- --json"
@_default: @_default:
just --list just --list
@ -31,21 +32,21 @@ factor hostname=`hostname -s` target='':
[doc('Wrapper for nixos-rebuild switch')] [doc('Wrapper for nixos-rebuild switch')]
[group("deploy")] [group("deploy")]
switch hostname=`hostname -s` target='': (build-system hostname) switch hostname=`hostname -s` target='':
#!/usr/bin/env -S bash -e #!/usr/bin/env -S bash -e
target="{{ target }}" target="{{ target }}"
if [ -z "$target" ]; then if [ -z "$target" ]; then
sudo {{ nixcmd }} run nixpkgs#nixos-rebuild -- switch --fast --flake .#{{ hostname }} sudo {{ nixcmd }} run nixpkgs#nixos-rebuild -- switch --fast --flake .#{{ hostname }} {{ nix_output_monitor }}
else else
{{ nixcmd }} run nixpkgs#nixos-rebuild -- switch \ {{ nixcmd }} run nixpkgs#nixos-rebuild -- switch \
--flake .#{{ hostname }} \ --flake .#{{ hostname }} \
--target-host {{ target }} \ --target-host {{ target }} \
--use-remote-sudo --use-remote-sudo {{ nix_output_monitor }}
fi fi
[doc('Use nixos-anywhere to deploy to a remote host')] [doc('Use nixos-anywhere to deploy to a remote host')]
[group('deploy')] [group('deploy')]
deploy-remote hostname target: (build-system hostname) deploy-remote hostname target:
#!/usr/bin/env -S bash -e #!/usr/bin/env -S bash -e
git add . git add .
@ -66,12 +67,12 @@ deploy-remote hostname target: (build-system hostname)
--flake .#{{ hostname }} \ --flake .#{{ hostname }} \
--disk-encryption-keys /luks-password <(just age -d ./secrets/luks-password.age) \ --disk-encryption-keys /luks-password <(just age -d ./secrets/luks-password.age) \
--extra-files "$temp" \ --extra-files "$temp" \
--target-host "{{ target }}" --target-host "{{ target }}" {{ nix_output_monitor }}
[doc('A wrapper disko-install')] [doc('A wrapper disko-install')]
[group('deploy')] [group('deploy')]
disko-install hostname disk: (build-system hostname) disko-install hostname disk:
sudo {{ nixcmd }} run 'github:nix-community/disko/latest#disko-install' -- --flake .#{{ hostname }} --disk main {{ disk }} sudo {{ nixcmd }} run 'github:nix-community/disko/latest#disko-install' -- --flake .#{{ hostname }} --disk main {{ disk }} {{ nix_output_monitor }}
[doc('Build an install ISO for a host')] [doc('Build an install ISO for a host')]
[group('deploy')] [group('deploy')]