diff --git a/nixos/doc/manual/man-nixos-generate-config.xml b/nixos/doc/manual/man-nixos-generate-config.xml
index ff69d8d9170..0771753f689 100644
--- a/nixos/doc/manual/man-nixos-generate-config.xml
+++ b/nixos/doc/manual/man-nixos-generate-config.xml
@@ -110,6 +110,14 @@
+
+
+
+ Omit everything concerning file system information
+ (which includes swap devices) from the hardware configuration.
+
+
+
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index 3418b0122de..03ee0041a5f 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -23,6 +23,7 @@ sub uniq {
my $outDir = "/etc/nixos";
my $rootDir = ""; # = /
my $force = 0;
+my $noFilesystems = 0;
for (my $n = 0; $n < scalar @ARGV; $n++) {
my $arg = $ARGV[$n];
@@ -43,6 +44,9 @@ for (my $n = 0; $n < scalar @ARGV; $n++) {
elsif ($arg eq "--force") {
$force = 1;
}
+ elsif ($arg eq "--no-filesystems") {
+ $noFilesystems = 1;
+ }
else {
die "$0: unrecognized argument ‘$arg’\n";
}
@@ -338,6 +342,12 @@ my $fn = "$outDir/hardware-configuration.nix";
print STDERR "writing $fn...\n";
mkpath($outDir, 0, 0755);
+my $fsAndSwap = "";
+if (!$noFilesystems) {
+ $fsAndSwap = "\n${fileSystems} ";
+ $fsAndSwap .= "swapDevices = " . multiLineList(" ", @swapDevices) . ";\n";
+}
+
write_file($fn, <