diff --git a/Justfile b/Justfile index 972336b..43c78a6 100644 --- a/Justfile +++ b/Justfile @@ -3,6 +3,8 @@ default: switch hostname := `hostname | cut -d "." -f 1` work_mac_impure := `if [ $(hostname) = "AMERMACC02G65A8MD6T" ]; then echo "--impure"; else echo ""; fi` +branch := `git branch --show-current` +commit := `git rev-parse HEAD` # Build the nix-darwin system configuration without switching to it [macos] @@ -30,7 +32,6 @@ reload-skhd: # on asahi linux, we need to pass the --impure flag to read in firmware files rebuild_flags := `if [ -d /boot/asahi ]; then echo "--impure"; else echo ""; fi` - # Build the NixOS configuration without switching to it [linux] build target_host=hostname flags="": @@ -65,7 +66,11 @@ sops-generate-keys: sudo cat /etc/ssh/ssh_host_ed25519_key | ssh-to-age --private-key > .sops.keys cat ~/.ssh/id_ed25519 | ssh-to-age --private-key >> .sops.keys -deploy target_host branch="main": - test -f nixos/hosts/{{target_host}}/.target || { echo "Host cannot be deployed, add a .target file with SSH destination"; exit 69; } - ssh -A `cat nixos/hosts/{{target_host}}/.target` sudo nixos-rebuild switch --flake \'git+https://codeberg.org/noe/nixos.git?ref={{branch}}#{{target_host}}\' +deploy target_host: + @test -f nixos/hosts/{{target_host}}/.target || { echo "Host cannot be deployed, add a .target file with SSH destination"; exit 1; } + ssh -A `cat nixos/hosts/{{target_host}}/.target` sudo nixos-rebuild switch --flake \"git+https://codeberg.org/noe/nixos.git?ref={{branch}}\&rev={{commit}}#{{target_host}}\" +# +ssh target_host *args='': + @test -f nixos/hosts/{{target_host}}/.target || { echo "Cannot SSH, add a .target file with SSH destination"; exit 1; } + ssh -A `cat nixos/hosts/{{target_host}}/.target` {{args}}