ditch superfluous substituters

This commit is contained in:
Kiara Grouwstra 2025-08-23 12:10:45 +02:00
parent 7a7343f0ea
commit 4d85dd96f2
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
2 changed files with 4 additions and 28 deletions

View file

@ -84,8 +84,6 @@ in
in
# import "${pathToRoot}/deployment/nixos.nix" {}
{
substituters = builtins.concatStringsSep " " os.config.nix.settings.substituters;
trusted_public_keys = builtins.concatStringsSep " " os.config.nix.settings.trusted-public-keys;
drv_path = os.config.system.build.toplevel.drvPath;
out_path = os.config.system.build.toplevel;
}
@ -97,21 +95,16 @@ in
json="$("''${command[@]}" --eval --strict --json)"
# DEPLOY
declare substituters trusted_public_keys drv_path
declare drv_path
# set our variables using the json object
eval "export $(echo $json | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')"
host="root@${nodeName}"
buildArgs=(
--option extra-binary-caches https://cache.nixos.org/
--option substituters $substituters
--option trusted-public-keys $trusted_public_keys
)
sshOpts=(
-o BatchMode=yes
-o StrictHostKeyChecking=no
)
# get the realized derivation to deploy
outPath=$(nix-store --realize "$drv_path" "''${buildArgs[@]}")
outPath=$(nix-store --realize "$drv_path")
# deploy the config by nix-copy-closure
NIX_SSHOPTS="''${sshOpts[*]}" nix-copy-closure --to "$host" "$outPath" --gzip --use-substitutes
# switch the remote host to the config

21
paste
View file

@ -1,12 +1,9 @@
declare substituters trusted_public_keys drv_path
declare drv_path
host="root@fedi203.abundos.eu"
sshOpts=(
-o BatchMode=yes
-o StrictHostKeyChecking=no
)
command=(nix-instantiate --expr '
let
sources = import ./npins;
@ -33,27 +30,13 @@ command=(nix-instantiate --expr '
};
in
{
substituters = builtins.concatStringsSep " " os.config.nix.settings.substituters;
trusted_public_keys = builtins.concatStringsSep " " os.config.nix.settings.trusted-public-keys;
drv_path = os.config.system.build.toplevel.drvPath;
out_path = os.config.system.build.toplevel;
}
')
buildArgs=(
--option extra-binary-caches https://cache.nixos.org/
--option substituters "$substituters"
--option trusted-public-keys "$trusted_public_keys"
)
"${command[@]}" -A out_path
json="$("${command[@]}" --eval --strict --json)"
eval "export $(echo $json | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')"
outPath=$(nix-store --realize "$drv_path" "${buildArgs[@]}")
outPath=$(nix-store --realize "$drv_path")
NIX_SSHOPTS="${sshOpts[*]}" nix-copy-closure --to "$host" "$outPath" --gzip --use-substitutes
ssh "${sshOpts[@]}" "$host" "nix-env --profile /nix/var/nix/profiles/system --set $outPath; $outPath/bin/switch-to-configuration switch"