feat(justfile): switch away from nh

replaces nh with a super cool and awesome bash script that basically
does the exact same thing except i am the one who wrote it so it's
cooler true and real
This commit is contained in:
uku 2025-03-04 09:48:06 +01:00
parent 840718e863
commit ba4b27b664
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
3 changed files with 27 additions and 10 deletions

View file

@ -5,25 +5,20 @@ check:
nix flake check
switch *args:
@sudo -v
nh os switch --no-nom --ask . -- --keep-going {{args}}
bash switch.sh {{ justfile_directory() }} {{args}}
rollback:
@sudo -v
sudo nixos-rebuild switch --rollback
boot *args:
@sudo -v
nh os boot --no-nom --ask . -- --keep-going {{args}}
sudo nixos-rebuild boot --flake {{ justfile_directory() }} --keep-going {{args}}
deploy system user="leo":
#!/usr/bin/env bash
set -euxo pipefail
set -euo pipefail
flake=$(nix eval --impure --raw --expr "(builtins.getFlake \"git+file://$PWD\").outPath")
nix copy "$flake" --to "ssh://{{user}}@{{system}}"
# -R/--bypass-root-check is needed because of a Git CVE regression in Nix 2.20
# See NixOS/nix#10202, viperML/nh#200
ssh -t "{{user}}@{{system}}" "sudo flock -w 60 /dev/shm/deploy-{{system}} nix run n#nh -- os switch --no-nom -R -H {{system}} --ask $flake"
ssh -t "{{user}}@{{system}}" "bash $flake/switch.sh $flake"
lint *args:
statix check -i flake.nix **/hardware-configuration.nix {{args}}