3
0
Fork 0
forked from mirrors/nixpkgs

nixos-generate-config: Enable strictness

This commit is contained in:
Eelco Dolstra 2016-05-25 14:56:28 +02:00
parent fa1b9ec1e6
commit c6ab4ab206

View file

@ -1,5 +1,6 @@
#! @perl@ #! @perl@
use strict;
use Cwd 'abs_path'; use Cwd 'abs_path';
use File::Spec; use File::Spec;
use File::Path; use File::Path;
@ -69,6 +70,7 @@ for (my $n = 0; $n < scalar @ARGV; $n++) {
my @attrs = (); my @attrs = ();
my @kernelModules = (); my @kernelModules = ();
my @initrdKernelModules = (); my @initrdKernelModules = ();
my @initrdAvailableKernelModules = ();
my @modulePackages = (); my @modulePackages = ();
my @imports; my @imports;
@ -379,7 +381,7 @@ EOF
# Is this a btrfs filesystem? # Is this a btrfs filesystem?
if ($fsType eq "btrfs") { if ($fsType eq "btrfs") {
my ($status, @id_info) = runCommand("btrfs subvol show $rootDir$mountPoint"); my ($status, @id_info) = runCommand("btrfs subvol show $rootDir$mountPoint");
if ($status != 0 || join("", @msg) =~ /ERROR:/) { if ($status != 0 || join("", @id_info) =~ /ERROR:/) {
die "Failed to retrieve subvolume info for $mountPoint\n"; die "Failed to retrieve subvolume info for $mountPoint\n";
} }
my @ids = join("", @id_info) =~ m/Subvolume ID:[ \t\n]*([^ \t\n]*)/; my @ids = join("", @id_info) =~ m/Subvolume ID:[ \t\n]*([^ \t\n]*)/;
@ -440,7 +442,7 @@ sub toNixList {
sub multiLineList { sub multiLineList {
my $indent = shift; my $indent = shift;
return " [ ]" if !@_; return " [ ]" if !@_;
$res = "\n${indent}[ "; my $res = "\n${indent}[ ";
my $first = 1; my $first = 1;
foreach my $s (@_) { foreach my $s (@_) {
$res .= "$indent " if !$first; $res .= "$indent " if !$first;
@ -494,7 +496,7 @@ if ($showHardwareConfig) {
if ($force || ! -e $fn) { if ($force || ! -e $fn) {
print STDERR "writing $fn...\n"; print STDERR "writing $fn...\n";
my $bootloaderConfig = ""; my $bootLoaderConfig = "";
if (-e "/sys/firmware/efi/efivars") { if (-e "/sys/firmware/efi/efivars") {
$bootLoaderConfig = <<EOF; $bootLoaderConfig = <<EOF;
# Use the gummiboot efi boot loader. # Use the gummiboot efi boot loader.
@ -568,7 +570,7 @@ $bootLoaderConfig
# }; # };
# The NixOS release to be compatible with for stateful data such as databases. # The NixOS release to be compatible with for stateful data such as databases.
system.stateVersion = "@nixosRelease@"; system.stateVersion = "${\(qw(@nixosRelease@))}";
} }
EOF EOF