Fix baremetal deployment
This commit is contained in:
parent
73e4cc7eb3
commit
89635cd5c9
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
# Show a diff when activating a new system except for microvms which handle this seperately
|
# Show a diff when activating a new system except for microvms which handle this seperately
|
||||||
diffSystem = config.c3d2.deployment.server == "";
|
diffSystem = config.c3d2.deployment.server or "" == "";
|
||||||
gc = lib.mkIf config.c3d2.autoUpdate {
|
gc = lib.mkIf config.c3d2.autoUpdate {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
randomizedDelaySec = "6h";
|
randomizedDelaySec = "6h";
|
||||||
|
|
|
@ -110,16 +110,17 @@ lib.attrsets.mapAttrs
|
||||||
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
|
|
||||||
${lib.optionalString (hostConfig.c3d2.deployment.server != "") ''
|
${lib.optionalString (hostConfig.c3d2.deployment.server or "" != "") ''
|
||||||
echo "microvms cannot be updated with nixos-rebuild. Use nix run .#microvm-update-${name}"
|
echo "microvms cannot be updated with nixos-rebuild. Use nix run .#microvm-update-${name}"
|
||||||
exit 2
|
exit 2
|
||||||
''}
|
''}
|
||||||
|
|
||||||
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
|
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
|
||||||
nix copy --no-check-sigs --to ssh-ng://${target} ${inputPaths}
|
nix copy --no-check-sigs --to ssh-ng://${target} ${inputPaths}
|
||||||
|
nix copy --no-check-sigs --derivation --to ssh-ng://${target} ${discardStringCtx hostConfig.system.build.nixos-rebuild.drvPath}
|
||||||
|
|
||||||
# use nixos-rebuild from target config
|
# use nixos-rebuild from target config
|
||||||
nixosRebuild=$(ssh ${target} nix build ${discardStringCtx hostConfig.system.build.nixos-rebuild.outPath or ""} ${overrideInputsArgs} --no-link --json | ${lib.getExe hostPkgs.jq} -r '.[0].outputs.out')
|
nixosRebuild=$(ssh ${target} nix build ${discardStringCtx hostConfig.system.build.nixos-rebuild.drvPath} ${overrideInputsArgs} --no-link --json | ${lib.getExe hostPkgs.jq} -r '.[0].outputs.out')
|
||||||
ssh ${target} $nixosRebuild/bin/nixos-rebuild ${rebuildArg} "$@"
|
ssh ${target} $nixosRebuild/bin/nixos-rebuild ${rebuildArg} "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue