@@ -21,6 +21,7 @@ nixOptions=(
21
21
" --no-write-lock-file"
22
22
)
23
23
SSH_PRIVATE_KEY=${SSH_PRIVATE_KEY-}
24
+ machineSubstituters=" y"
24
25
25
26
declare -A phases
26
27
phases[kexec]=1
@@ -116,6 +117,9 @@ Options:
116
117
after kexec but before installation. Can be repeated.
117
118
* --no-substitute-on-destination
118
119
disable passing --substitute-on-destination to nix-copy
120
+ implies --no-use-machine-substituters
121
+ * --no-use-machine-substituters
122
+ don't copy the substituters from the machine to be installed into the installer environment
119
123
* --debug
120
124
enable debug output
121
125
* --show-trace
@@ -332,6 +336,10 @@ parseArgs() {
332
336
;;
333
337
--no-substitute-on-destination)
334
338
substituteOnDestination=n
339
+ machineSubstituters=n
340
+ ;;
341
+ --no-use-machine-substituters)
342
+ machineSubstituters=n
335
343
;;
336
344
--build-on-remote)
337
345
echo " WARNING: --build-on-remote is deprecated, use --build-on remote instead" 2>&1
@@ -906,6 +914,18 @@ main() {
906
914
sshConnection=" root@${sshHost} "
907
915
fi
908
916
917
+ # Get substituters from the machine and add them to the installer
918
+ if [[ ${machineSubstituters} == " y" && -n ${flake} ]]; then
919
+ substituters=$( nix --extra-experimental-features ' nix-command flakes' eval --apply toString " ${flake} " # "${flakeAttr}".nix.settings.substituters)
920
+ trustedPublicKeys=$( nix --extra-experimental-features ' nix-command flakes' eval --apply toString " ${flake} " # "${flakeAttr}".nix.settings.trusted-public-keys)
921
+
922
+ runSsh sh << SSH || true
923
+ mkdir -p ~/.config/nix
924
+ echo "extra-substituters = ${substituters} " >> ~/.config/nix/nix.conf
925
+ echo "extra-trusted-public-keys = ${trustedPublicKeys} " >> ~/.config/nix/nix.conf
926
+ SSH
927
+ fi
928
+
909
929
if [[ ${phases[disko]} == 1 ]]; then
910
930
runDisko " $diskoScript "
911
931
fi
0 commit comments