forked from c3d2/nix-config
flake.nix: nix copy ${inputPaths}
This commit is contained in:
parent
116bae9d15
commit
d27f464047
18
flake.nix
18
flake.nix
|
@ -96,6 +96,10 @@
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
forAllSystems = lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
|
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, ... }:
|
extractZwHosts = { hosts4, hosts6, ... }:
|
||||||
lib.recursiveUpdate (
|
lib.recursiveUpdate (
|
||||||
builtins.foldl' (result: name:
|
builtins.foldl' (result: name:
|
||||||
|
@ -195,8 +199,7 @@
|
||||||
prebuild-all-remote = pkgs.writeScriptBin "prebuild-all" ''
|
prebuild-all-remote = pkgs.writeScriptBin "prebuild-all" ''
|
||||||
#!${pkgs.runtimeShell} -e
|
#!${pkgs.runtimeShell} -e
|
||||||
|
|
||||||
nix copy --to ssh://$1 ${secrets}
|
nix copy --to ssh://$1 ${inputPaths}
|
||||||
nix copy --to ssh://$1 ${self}
|
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
ssh $1 -- nix build -L --no-link ${
|
ssh $1 -- nix build -L --no-link ${
|
||||||
|
@ -234,17 +237,14 @@
|
||||||
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
||||||
#!${pkgs.runtimeShell} -ex
|
#!${pkgs.runtimeShell} -ex
|
||||||
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
|
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
|
||||||
nix copy --to ssh://${target} ${secrets}
|
nix copy --to ssh://${target} ${inputPaths}
|
||||||
nix copy --to ssh://${target} ${self}
|
|
||||||
ssh ${target} nixos-rebuild ${rebuildArg} "$@"
|
ssh ${target} nixos-rebuild ${rebuildArg} "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"${name}-nixos-rebuild-hydra" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
"${name}-nixos-rebuild-hydra" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
||||||
#!${pkgs.runtimeShell} -e
|
#!${pkgs.runtimeShell} -e
|
||||||
echo Copying Flakes 1/2
|
echo Copying Flakes
|
||||||
nix copy --to ssh://root@hydra.serv.zentralwerk.org ${secrets}
|
nix copy --to ssh://root@hydra.serv.zentralwerk.org ${inputPaths}
|
||||||
echo Copying Flakes 2/2
|
|
||||||
nix copy --to ssh://root@hydra.serv.zentralwerk.org ${self}
|
|
||||||
echo Building on Hydra
|
echo Building on Hydra
|
||||||
ssh root@hydra.serv.zentralwerk.org -- \
|
ssh root@hydra.serv.zentralwerk.org -- \
|
||||||
nix build -L -o /tmp/nixos-system-${name} \
|
nix build -L -o /tmp/nixos-system-${name} \
|
||||||
|
@ -277,7 +277,7 @@
|
||||||
} // lib.optionalAttrs (builtins.elem (hostConfig.c3d2.deployment.server or null) [ "server9" "server10" ]) {
|
} // lib.optionalAttrs (builtins.elem (hostConfig.c3d2.deployment.server or null) [ "server9" "server10" ]) {
|
||||||
"microvm-update-${name}" = pkgs.writeScriptBin "microvm-update-${name}" ''
|
"microvm-update-${name}" = pkgs.writeScriptBin "microvm-update-${name}" ''
|
||||||
#!${pkgs.runtimeShell} -e
|
#!${pkgs.runtimeShell} -e
|
||||||
${hostConfig.system.build.copyToServer} ${self} ${secrets}
|
${hostConfig.system.build.copyToServer} ${inputPaths}
|
||||||
|
|
||||||
${hostConfig.system.build.runOnServer} bash -e <<END
|
${hostConfig.system.build.runOnServer} bash -e <<END
|
||||||
mkdir -p /var/lib/microvms/${name}
|
mkdir -p /var/lib/microvms/${name}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user