forked from Fediversity/Fediversity
ditch superfluous substituters
This commit is contained in:
parent
4b7c41ae26
commit
61e222e216
2 changed files with 4 additions and 28 deletions
|
@ -84,8 +84,6 @@ in
|
||||||
in
|
in
|
||||||
# import "${pathToRoot}/deployment/nixos.nix" {}
|
# 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;
|
drv_path = os.config.system.build.toplevel.drvPath;
|
||||||
out_path = os.config.system.build.toplevel;
|
out_path = os.config.system.build.toplevel;
|
||||||
}
|
}
|
||||||
|
@ -97,21 +95,16 @@ in
|
||||||
json="$("''${command[@]}" --eval --strict --json)"
|
json="$("''${command[@]}" --eval --strict --json)"
|
||||||
|
|
||||||
# DEPLOY
|
# DEPLOY
|
||||||
declare substituters trusted_public_keys drv_path
|
declare drv_path
|
||||||
# set our variables using the json object
|
# set our variables using the json object
|
||||||
eval "export $(echo $json | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')"
|
eval "export $(echo $json | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')"
|
||||||
host="root@${nodeName}"
|
host="root@${nodeName}"
|
||||||
buildArgs=(
|
|
||||||
--option extra-binary-caches https://cache.nixos.org/
|
|
||||||
--option substituters $substituters
|
|
||||||
--option trusted-public-keys $trusted_public_keys
|
|
||||||
)
|
|
||||||
sshOpts=(
|
sshOpts=(
|
||||||
-o BatchMode=yes
|
-o BatchMode=yes
|
||||||
-o StrictHostKeyChecking=no
|
-o StrictHostKeyChecking=no
|
||||||
)
|
)
|
||||||
# get the realized derivation to deploy
|
# 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
|
# deploy the config by nix-copy-closure
|
||||||
NIX_SSHOPTS="''${sshOpts[*]}" nix-copy-closure --to "$host" "$outPath" --gzip --use-substitutes
|
NIX_SSHOPTS="''${sshOpts[*]}" nix-copy-closure --to "$host" "$outPath" --gzip --use-substitutes
|
||||||
# switch the remote host to the config
|
# switch the remote host to the config
|
||||||
|
|
21
paste
21
paste
|
@ -1,12 +1,9 @@
|
||||||
declare substituters trusted_public_keys drv_path
|
declare drv_path
|
||||||
|
|
||||||
host="root@fedi203.abundos.eu"
|
host="root@fedi203.abundos.eu"
|
||||||
|
|
||||||
sshOpts=(
|
sshOpts=(
|
||||||
-o BatchMode=yes
|
-o BatchMode=yes
|
||||||
-o StrictHostKeyChecking=no
|
-o StrictHostKeyChecking=no
|
||||||
)
|
)
|
||||||
|
|
||||||
command=(nix-instantiate --expr '
|
command=(nix-instantiate --expr '
|
||||||
let
|
let
|
||||||
sources = import ./npins;
|
sources = import ./npins;
|
||||||
|
@ -33,27 +30,13 @@ command=(nix-instantiate --expr '
|
||||||
};
|
};
|
||||||
in
|
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;
|
drv_path = os.config.system.build.toplevel.drvPath;
|
||||||
out_path = os.config.system.build.toplevel;
|
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
|
"${command[@]}" -A out_path
|
||||||
|
|
||||||
json="$("${command[@]}" --eval --strict --json)"
|
json="$("${command[@]}" --eval --strict --json)"
|
||||||
|
|
||||||
eval "export $(echo $json | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')"
|
eval "export $(echo $json | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')"
|
||||||
|
outPath=$(nix-store --realize "$drv_path")
|
||||||
outPath=$(nix-store --realize "$drv_path" "${buildArgs[@]}")
|
|
||||||
|
|
||||||
NIX_SSHOPTS="${sshOpts[*]}" nix-copy-closure --to "$host" "$outPath" --gzip --use-substitutes
|
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"
|
ssh "${sshOpts[@]}" "$host" "nix-env --profile /nix/var/nix/profiles/system --set $outPath; $outPath/bin/switch-to-configuration switch"
|
||||||
|
|
Loading…
Add table
Reference in a new issue