about summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorBernardo Meurer <bernardo@meurer.org>2022-06-23 12:18:20 -0400
committerGitHub <noreply@github.com>2022-06-23 12:18:20 -0400
commitc7eacbf87e61476b8ee6c12cca94b3d30e71aab4 (patch)
tree8f039c304821816ab55ba84c756d1ba45e4fd227 /nixos/modules/installer
parentefe792bb2068d3a06440cb981c8de919810ac8fa (diff)
parent82da0794c28cf7eff6f0a3755fe8ec9d1cb8ed7f (diff)
Merge pull request #177672 from hercules-ci/nixos-generate-config-add-nixpkgs.system
nixos-generate-config: Add nixpkgs.hostPlatform to hardware-configuration.nix
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/tools/nixos-generate-config.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index b74ec838df42f..1935d8252607c 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -84,6 +84,15 @@ sub debug {
 }
 
 
+# nixpkgs.system
+my ($status, @systemLines) = runCommand("nix-instantiate --impure --eval --expr builtins.currentSystem");
+if ($status != 0 || join("", @systemLines) =~ /error/) {
+    die "Failed to retrieve current system type from nix.\n";
+}
+chomp(my $system = @systemLines[0]);
+push @attrs, "nixpkgs.hostPlatform = lib.mkDefault $system;";
+
+
 my $cpuinfo = read_file "/proc/cpuinfo";