deploy test only worked for vms, not containers

This commit is contained in:
goeranh 2026-02-28 14:44:33 +01:00
parent dbc53eee65
commit 99b1a87ad9
No known key found for this signature in database

View file

@ -48,28 +48,6 @@
"${name}-update" = nixpkgs.legacyPackages.x86_64-linux.writeShellScriptBin "update" ''
nixos-rebuild switch --flake .#${name} --target-host root@${(builtins.head (nixosConfigurations.${name}.config.networking.interfaces.${builtins.head (builtins.attrNames nixosConfigurations.${name}.config.networking.interfaces)}.ipv4.addresses)).address}
'';
# copy install image to testserver and deploy the specified configuration to it
"${name}-deploy-test" = nixpkgs.legacyPackages.x86_64-linux.writeShellScriptBin "deploy" ''
FILENAME="$(ls ${self.packages.x86_64-linux."installer-iso".outPath}/iso)"
scp ${
self.packages.x86_64-linux."installer-iso".outPath
}/iso/$FILENAME root@10.1.0.17:/var/lib/vz/template/iso/$FILENAME
ssh 10.1.0.17 "qm create $1 --name ${
nixosConfigurations.${name}.config.networking.fqdn
} --cores 4 --memory 4096 --sata1 file=/var/lib/vz/template/iso/$FILENAME,media=cdrom --scsi1 pool1:32 --scsihw virtio-scsi-single --net0 virtio,bridge=vmbr1 --description \"von goeranh mailserver flake genierierte wegwerf-vm <br> ${
nixosConfigurations.${name}.config.networking.fqdn
}\""
ssh 10.1.0.17 "qm start $1"
# hardcoded deployment ip
# wait until a connection to port 22 on the deployment ip is reachable
until nc -vzw 2 141.56.51.98 22 2>/dev/null; do echo trying; sleep 2; done
# run nixos-anywhere on the deployment address with the specified configuration
nix run github:nix-community/nixos-anywhere -- --flake .#${name} --target-host root@141.56.51.98
'';
}
)
{ }