just deploy
This commit is contained in:
parent
3aa25b3a58
commit
e67311b5ec
1 changed files with 9 additions and 4 deletions
13
Justfile
13
Justfile
|
@ -3,6 +3,8 @@ default: switch
|
||||||
|
|
||||||
hostname := `hostname | cut -d "." -f 1`
|
hostname := `hostname | cut -d "." -f 1`
|
||||||
work_mac_impure := `if [ $(hostname) = "AMERMACC02G65A8MD6T" ]; then echo "--impure"; else echo ""; fi`
|
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
|
# Build the nix-darwin system configuration without switching to it
|
||||||
[macos]
|
[macos]
|
||||||
|
@ -30,7 +32,6 @@ reload-skhd:
|
||||||
# on asahi linux, we need to pass the --impure flag to read in firmware files
|
# 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`
|
rebuild_flags := `if [ -d /boot/asahi ]; then echo "--impure"; else echo ""; fi`
|
||||||
|
|
||||||
|
|
||||||
# Build the NixOS configuration without switching to it
|
# Build the NixOS configuration without switching to it
|
||||||
[linux]
|
[linux]
|
||||||
build target_host=hostname flags="":
|
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
|
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
|
cat ~/.ssh/id_ed25519 | ssh-to-age --private-key >> .sops.keys
|
||||||
|
|
||||||
deploy target_host branch="main":
|
deploy target_host:
|
||||||
test -f nixos/hosts/{{target_host}}/.target || { echo "Host cannot be deployed, add a .target file with SSH destination"; exit 69; }
|
@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}}#{{target_host}}\'
|
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}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue