diff --git a/Justfile b/Justfile index 650161f..972336b 100644 --- a/Justfile +++ b/Justfile @@ -54,7 +54,6 @@ gc generations="5d": sudo nix-env --delete-generations {{generations}} sudo nix-store --gc sudo nix-collect-garbage -d - nix-collect-garbage # Add a machine's age key for SOPS sops-add machine_name target: @@ -66,7 +65,7 @@ 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 target_override="": - TARGET= - if [ "{{target_override}}" == "" ]; then TARGET=$(cat nixos/hosts/{{target_host}}/.target); else TARGET="{{target_override}}"; fi - @echo "TARGET=$TARGET" +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}}\' + diff --git a/nixos/hosts/blueberry/.target b/nixos/hosts/blueberry/.target new file mode 100644 index 0000000..0b3c629 --- /dev/null +++ b/nixos/hosts/blueberry/.target @@ -0,0 +1 @@ +192.168.1.229 diff --git a/nixos/hosts/blueberry/default.nix b/nixos/hosts/blueberry/default.nix index 17401d3..3c1b316 100644 --- a/nixos/hosts/blueberry/default.nix +++ b/nixos/hosts/blueberry/default.nix @@ -4,7 +4,7 @@ ./hardware-configuration.nix ../../server.nix ../../features/systemd-boot.nix - #../../features/podman.nix + ../../features/podman.nix ]; networking.hostName = "blueberry";