flake.nix: nix copy ${inputPaths}

This commit is contained in:
Astro 2022-07-16 01:00:45 +02:00
parent 116bae9d15
commit d27f464047
1 changed files with 9 additions and 9 deletions

View File

@ -96,6 +96,10 @@
inherit (nixpkgs) lib;
forAllSystems = lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
# all the input flakes for `nix copy` to the build machine,
# allowing --override-input
inputPaths = lib.escapeShellArgs (builtins.attrValues inputs);
extractZwHosts = { hosts4, hosts6, ... }:
lib.recursiveUpdate (
builtins.foldl' (result: name:
@ -195,8 +199,7 @@
prebuild-all-remote = pkgs.writeScriptBin "prebuild-all" ''
#!${pkgs.runtimeShell} -e
nix copy --to ssh://$1 ${secrets}
nix copy --to ssh://$1 ${self}
nix copy --to ssh://$1 ${inputPaths}
set -x
ssh $1 -- nix build -L --no-link ${
@ -234,17 +237,14 @@
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
#!${pkgs.runtimeShell} -ex
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
nix copy --to ssh://${target} ${secrets}
nix copy --to ssh://${target} ${self}
nix copy --to ssh://${target} ${inputPaths}
ssh ${target} nixos-rebuild ${rebuildArg} "$@"
'';
"${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}
echo Copying Flakes
nix copy --to ssh://root@hydra.serv.zentralwerk.org ${inputPaths}
echo Building on Hydra
ssh root@hydra.serv.zentralwerk.org -- \
nix build -L -o /tmp/nixos-system-${name} \
@ -277,7 +277,7 @@
} // lib.optionalAttrs (builtins.elem (hostConfig.c3d2.deployment.server or null) [ "server9" "server10" ]) {
"microvm-update-${name}" = pkgs.writeScriptBin "microvm-update-${name}" ''
#!${pkgs.runtimeShell} -e
${hostConfig.system.build.copyToServer} ${self} ${secrets}
${hostConfig.system.build.copyToServer} ${inputPaths}
${hostConfig.system.build.runOnServer} bash -e <<END
mkdir -p /var/lib/microvms/${name}