From a546069ad34f72ac0ae57ae87b76fe26350494ad Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 23 Oct 2013 15:55:27 +0200 Subject: [PATCH] nixos-generate-config: Add --no-filesystems flag. This is to get back the old behavior of nixos-hardware-scan, which didn't include fileSystems and swapDevices. Signed-off-by: aszlig --- nixos/doc/manual/man-nixos-generate-config.xml | 8 ++++++++ .../installer/tools/nixos-generate-config.pl | 14 +++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) 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, <