diff options
author | Artturi <Artturin@artturin.com> | 2022-03-22 02:35:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 02:35:06 +0200 |
commit | 6134c2f891de397117b7b9521102eb95b198912c (patch) | |
tree | 7eb45103012bc46b5e8c9c0deefa867a6a36a195 /nixos/modules | |
parent | 3d9818b9c79690c972469ab1a318c74cf1d89f3c (diff) | |
parent | 611b8c4472db0bde066b97960ccfe4671ffb89fb (diff) | |
download | nixlib-6134c2f891de397117b7b9521102eb95b198912c.tar nixlib-6134c2f891de397117b7b9521102eb95b198912c.tar.gz nixlib-6134c2f891de397117b7b9521102eb95b198912c.tar.bz2 nixlib-6134c2f891de397117b7b9521102eb95b198912c.tar.lz nixlib-6134c2f891de397117b7b9521102eb95b198912c.tar.xz nixlib-6134c2f891de397117b7b9521102eb95b198912c.tar.zst nixlib-6134c2f891de397117b7b9521102eb95b198912c.zip |
Merge pull request #161034 from andr1an/fix/nixos-generate-config-absolute-root-path
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/installer/tools/nixos-generate-config.pl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 57aef50a0f6b..fb5d3ba47325 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -51,7 +51,9 @@ for (my $n = 0; $n < scalar @ARGV; $n++) { $n++; $rootDir = $ARGV[$n]; die "$0: ‘--root’ requires an argument\n" unless defined $rootDir; + die "$0: no need to specify `/` with `--root`, it is the default\n" if $rootDir eq "/"; $rootDir =~ s/\/*$//; # remove trailing slashes + $rootDir = File::Spec->rel2abs($rootDir); # resolve absolute path } elsif ($arg eq "--force") { $force = 1; @@ -616,7 +618,12 @@ EOF if ($showHardwareConfig) { print STDOUT $hwConfig; } else { - $outDir = "$rootDir$outDir"; + if ($outDir eq "/etc/nixos") { + $outDir = "$rootDir$outDir"; + } else { + $outDir = File::Spec->rel2abs($outDir); + $outDir =~ s/\/*$//; # remove trailing slashes + } my $fn = "$outDir/hardware-configuration.nix"; print STDERR "writing $fn...\n"; |