diff options
author | Robert Hensing <robert@roberthensing.nl> | 2022-06-21 14:37:16 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2022-06-21 14:37:16 +0200 |
commit | 82da0794c28cf7eff6f0a3755fe8ec9d1cb8ed7f (patch) | |
tree | 7bad789b47b5a873f201588e7805d5797c6bfee4 | |
parent | 1b4f4ddb5b566a4348880738f0489a19f7b05e57 (diff) |
nixos-generate-config: Make robust against missing newline
The substr solution assumed a newline to be present. The new solution will not remove the newline if it goes missing in the future. Apparently this is idiomatic perl. Thanks pennae for the suggestion!
-rw-r--r-- | nixos/modules/installer/tools/nixos-generate-config.pl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 65b5c0331f42d..1935d8252607c 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -89,7 +89,7 @@ my ($status, @systemLines) = runCommand("nix-instantiate --impure --eval --expr if ($status != 0 || join("", @systemLines) =~ /error/) { die "Failed to retrieve current system type from nix.\n"; } -my $system = substr(@systemLines[0], 0, -1); +chomp(my $system = @systemLines[0]); push @attrs, "nixpkgs.hostPlatform = lib.mkDefault $system;"; |