@@ -8,6 +8,7 @@ kexecUrl=""
8
8
kexecExtraFlags=" "
9
9
enableDebug=" "
10
10
diskoScript=" "
11
+ diskoMode=" disko"
11
12
nixosSystem=" "
12
13
extraFiles=" "
13
14
vmTest=" n"
@@ -116,6 +117,11 @@ Options:
116
117
disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
117
118
install: install the system
118
119
reboot: reboot the machine
120
+ * --disko-mode create|mount|disko
121
+ set the disko mode to create, mount or destroy. Default is disko.
122
+ format: create partition tables, zpools, lvms, raids and filesystems (Experimental: Can be run increntally, but use with caution and good backups)
123
+ mount: mount the partition at the specified root-mountpoint
124
+ disko: first unmount and destroy all filesystems on the disks we want to format, then run the create and mount mode
119
125
USAGE
120
126
}
121
127
@@ -201,6 +207,18 @@ parseArgs() {
201
207
printBuildLogs=y
202
208
set -x
203
209
;;
210
+ --disko-mode)
211
+ case " $2 " in
212
+ create | mount | disko)
213
+ diskoMode=$2
214
+ ;;
215
+ * )
216
+ abort " Supported values for --disko-mode create, mount, disko. Unknown mode : $2 "
217
+ ;;
218
+ esac
219
+
220
+ shift
221
+ ;;
204
222
--extra-files)
205
223
extraFiles=$2
206
224
shift
@@ -518,11 +536,11 @@ runDisko() {
518
536
step Building disko script
519
537
# We need to do a nix copy first because nix build doesn't have --no-check-sigs
520
538
# Use ssh:// here to avoid https://github.com/NixOS/nix/issues/7359
521
- nixCopy --to " ssh://$sshConnection " " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.diskoScript " \
539
+ nixCopy --to " ssh://$sshConnection " " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.${diskoMode} Script " \
522
540
--derivation --no-check-sigs
523
541
# If we don't use ssh-ng here, we get `error: operation 'getFSAccessor' is not supported by store`
524
542
diskoScript=$(
525
- nixBuild " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.diskoScript " \
543
+ nixBuild " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.${diskoMode} Script " \
526
544
--eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$sshKeyDir /nixos-anywhere"
527
545
)
528
546
fi
@@ -602,7 +620,7 @@ main() {
602
620
# parse flake nixos-install style syntax, get the system attr
603
621
if [[ -n ${flake} ]]; then
604
622
if [[ ${buildOnRemote} == " n" ]] && [[ ${hardwareConfigBackend} == " none" ]]; then
605
- diskoScript=$( nixBuild " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.diskoScript " )
623
+ diskoScript=$( nixBuild " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.${diskoMode} Script " )
606
624
nixosSystem=$( nixBuild " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.toplevel" )
607
625
fi
608
626
elif [[ -n ${diskoScript} ]] && [[ -n ${nixosSystem} ]]; then
@@ -658,7 +676,7 @@ main() {
658
676
fi
659
677
660
678
if [[ ${buildOnRemote} == " n" ]] && [[ -n ${flake} ]] && [[ ${hardwareConfigBackend} != " none" ]]; then
661
- diskoScript=$( nixBuild " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.diskoScript " )
679
+ diskoScript=$( nixBuild " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.${diskoMode} Script " )
662
680
nixosSystem=$( nixBuild " ${flake} #nixosConfigurations.\" ${flakeAttr} \" .config.system.build.toplevel" )
663
681
fi
664
682
0 commit comments