1
0
forked from c3d2/nix-config

flake.nix: rename prebuild-${name}-on-hydra to ${name}-nixos-rebuild-hydra and extend

This commit is contained in:
Astro 2022-07-01 19:45:29 +02:00
parent b29d7e936f
commit 62749f3ee5

View File

@ -237,12 +237,28 @@
ssh ${target} nixos-rebuild ${rebuildArg} "$@"
'';
"prebuild-${name}-on-hydra" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
#!${pkgs.runtimeShell} -ex
"${name}-nixos-rebuild-hydra" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
#!${pkgs.runtimeShell} -e
echo Copying Flakes 1/2
nix copy --to ssh://root@hydra.serv.zentralwerk.org ${secrets}
echo Copying Flakes 2/2
nix copy --to ssh://root@hydra.serv.zentralwerk.org ${self}
ssh ssh://root@hydra.serv.zentralwerk.org -- \
nix build -L ${self}#nixosConfigurations.${name}.config.system.build.toplevel
echo Building on Hydra
ssh root@hydra.serv.zentralwerk.org -- \
nix build -L -o /tmp/nixos-system-${name} \
${self}#nixosConfigurations.${name}.config.system.build.toplevel
echo Built. Obtaining link to data
TOPLEVEL=$(ssh root@hydra.serv.zentralwerk.org \
readlink /tmp/nixos-system-${name})
echo Checking target ${name}
ssh ${target} -- bash -e <<EOF
[[ \$(cat /etc/hostname) == ${name} ]]
echo Copying data from Hydra to ${name}
nix copy --from https://hydra.hq.c3d2.de \
$TOPLEVEL
echo Activation on ${name}: "$@"
$TOPLEVEL/bin/switch-to-configuration "$@"
EOF
'';
"${name}-nixos-rebuild-local" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''