6
6
flakeAttr=" "
7
7
kexecUrl=" "
8
8
kexecExtraFlags=" "
9
+ sshStoreSettings=" "
9
10
enableDebug=" "
10
11
nixBuildFlags=()
11
12
diskoScript=" "
@@ -94,6 +95,8 @@ Options:
94
95
use another kexec tarball to bootstrap NixOS
95
96
* --kexec-extra-flags
96
97
extra flags to add into the call to kexec, e.g. "--no-sync"
98
+ * --ssh-store-setting <key> <value>
99
+ ssh store settings appended to the store URI, e.g. "compress true". <value> needs to be URI encoded.
97
100
* --post-kexec-ssh-port <ssh_port>
98
101
after kexec is executed, use a custom ssh port to connect. Defaults to 22
99
102
* --copy-host-keys
@@ -213,6 +216,14 @@ parseArgs() {
213
216
kexecExtraFlags=$2
214
217
shift
215
218
;;
219
+ --ssh-store-setting)
220
+ key=$2
221
+ shift
222
+ value=$2
223
+ shift
224
+ sshStoreSettings+=" $sshStoreSettings$key =$value &"
225
+ shift
226
+ ;;
216
227
--post-kexec-ssh-port)
217
228
postKexecSshPort=$2
218
229
shift
@@ -628,17 +639,17 @@ runDisko() {
628
639
runSsh " umask 077; mkdir -p \" $( dirname " $path " ) \" ; cat > $path " < " ${diskEncryptionKeys[$path]} "
629
640
done
630
641
if [[ -n ${diskoScript} ]]; then
631
- nixCopy --to " ssh://$sshConnection " " $diskoScript "
642
+ nixCopy --to " ssh://$sshConnection ? $sshStoreSettings " " $diskoScript "
632
643
elif [[ ${buildOn} == " remote" ]]; then
633
644
step Building disko script
634
645
# We need to do a nix copy first because nix build doesn't have --no-check-sigs
635
646
# Use ssh:// here to avoid https://github.com/NixOS/nix/issues/7359
636
- nixCopy --to " ssh://$sshConnection " " ${flake} #${flakeAttr} .system.build.${diskoMode} Script" \
647
+ nixCopy --to " ssh://$sshConnection ? $sshStoreSettings " " ${flake} #${flakeAttr} .system.build.${diskoMode} Script" \
637
648
--derivation --no-check-sigs
638
649
# If we don't use ssh-ng here, we get `error: operation 'getFSAccessor' is not supported by store`
639
650
diskoScript=$(
640
651
nixBuild " ${flake} #${flakeAttr} .system.build.${diskoMode} Script" \
641
- --eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$sshKeyDir /nixos -anywhere"
652
+ --eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$sshKeyDir %2Fnixos -anywhere& $sshStoreSettings "
642
653
)
643
654
fi
644
655
@@ -650,17 +661,17 @@ nixosInstall() {
650
661
local nixosSystem=$1
651
662
if [[ -n ${nixosSystem} ]]; then
652
663
step Uploading the system closure
653
- nixCopy --to " ssh://$sshConnection ?remote-store=local?root=/mnt " " $nixosSystem "
664
+ nixCopy --to " ssh://$sshConnection ?remote-store=local%3Froot=%2Fmnt& $sshStoreSettings " " $nixosSystem "
654
665
elif [[ ${buildOn} == " remote" ]]; then
655
666
step Building the system closure
656
667
# We need to do a nix copy first because nix build doesn't have --no-check-sigs
657
668
# Use ssh:// here to avoid https://github.com/NixOS/nix/issues/7359
658
- nixCopy --to " ssh://$sshConnection ?remote-store=local?root=/mnt " " ${flake} #${flakeAttr} .system.build.toplevel" \
669
+ nixCopy --to " ssh://$sshConnection ?remote-store=local%3Froot=%2Fmnt& $sshStoreSettings " " ${flake} #${flakeAttr} .system.build.toplevel" \
659
670
--derivation --no-check-sigs
660
671
# If we don't use ssh-ng here, we get `error: operation 'getFSAccessor' is not supported by store`
661
672
nixosSystem=$(
662
673
nixBuild " ${flake} #${flakeAttr} .system.build.toplevel" \
663
- --eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$sshKeyDir /nixos -anywhere&remote-store=local?root=/mnt "
674
+ --eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$sshKeyDir %2Fnixos -anywhere&remote-store=local%3Froot=%2Fmnt& $sshStoreSettings "
664
675
)
665
676
fi
666
677
@@ -691,7 +702,7 @@ if [ ${copyHostKeys-n} = "y" ]; then
691
702
cp -a "\$ p" "/mnt/\$ p"
692
703
done
693
704
fi
694
- nixos-install --no-root-passwd --no-channel-copy --system "$nixosSystem "
705
+ NIXOS_NO_CHECK=1 nixos-install --no-root-passwd --no-channel-copy --system "$nixosSystem "
695
706
if [[ ${phases[reboot]} == 1 ]]; then
696
707
if command -v zpool >/dev/null && [ "\$ (zpool list)" != "no pools available" ]; then
697
708
# we always want to export the zfs pools so people can boot from it without force import
@@ -726,7 +737,9 @@ main() {
726
737
if [[ ${phases[disko]} == 1 ]]; then
727
738
diskoScript=$( nixBuild " ${flake} #${flakeAttr} .system.build.${diskoMode} Script" )
728
739
fi
729
- nixosSystem=$( nixBuild " ${flake} #${flakeAttr} .system.build.toplevel" )
740
+ if [[ ${phases[install]} == 1 ]]; then
741
+ nixosSystem=$( nixBuild " ${flake} #${flakeAttr} .system.build.toplevel" )
742
+ fi
730
743
fi
731
744
elif [[ -n ${diskoScript} ]] && [[ -n ${nixosSystem} ]]; then
732
745
if [[ ! -e ${diskoScript} ]] || [[ ! -e ${nixosSystem} ]]; then
@@ -799,7 +812,9 @@ main() {
799
812
if [[ ${phases[disko]} == 1 ]]; then
800
813
diskoScript=$( nixBuild " ${flake} #${flakeAttr} .system.build.${diskoMode} Script" )
801
814
fi
802
- nixosSystem=$( nixBuild " ${flake} #${flakeAttr} .system.build.toplevel" )
815
+ if [[ ${phases[install]} == 1 ]]; then
816
+ nixosSystem=$( nixBuild " ${flake} #${flakeAttr} .system.build.toplevel" )
817
+ fi
803
818
fi
804
819
805
820
# Installation will fail if non-root user is used for installer.
0 commit comments