You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
generate a hardware-configuration.nix file using the specified backend and write it to the specified path.
112
+
The backend can be either 'facter' or 'nixos-generate-config'.
107
113
* --phases
108
114
comma separated list of phases to run. Default is: kexec,disko,install,reboot
109
115
kexec: kexec into the nixos installer
@@ -152,6 +158,22 @@ parseArgs() {
152
158
shift
153
159
shift
154
160
;;
161
+
--generate-hardware-config)
162
+
if [[ $#-lt 3 ]];then
163
+
abort "Missing arguments for --generate-hardware-config <backend> <path>"
164
+
fi
165
+
case"$2"in
166
+
nixos-facter | nixos-generate-config)
167
+
hardwareConfigBackend=$2
168
+
;;
169
+
*)
170
+
abort "Unknown hardware config backend: $2"
171
+
;;
172
+
esac
173
+
hardwareConfigPath=$3
174
+
shift
175
+
shift
176
+
;;
155
177
-t | --tty)
156
178
echo"the '$1' flag is deprecated, a tty is now detected automatically">&2
157
179
;;
@@ -387,6 +409,39 @@ importFacts() {
387
409
done
388
410
}
389
411
412
+
generateHardwareConfig() {
413
+
local maybeSudo="$maybeSudo"
414
+
case"$hardwareConfigBackend"in
415
+
nixos-facter)
416
+
if [[ ${isInstaller}=="y" ]];then
417
+
if [[ ${hasNixOSFacter}=="n" ]];then
418
+
abort "nixos-facter is not available in booted installer. You may want to boot an installer image from here instead: https://github.com/nix-community/nixos-images"
419
+
fi
420
+
else
421
+
maybeSudo=""
422
+
fi
423
+
424
+
step "Generating hardware-configuration.nix using nixos-facter"
425
+
# FIXME: if we take the output directly it adds some weird characters at the beginning
0 commit comments