Merge pull request #228133 from name-snrl/fix-nix-in-nixos-generate-config

Use `hostPlatform.system` in `nixos-generate-config`
This commit is contained in:
Robert Hensing 2023-04-26 23:19:55 +02:00 committed by GitHub
commit 87676d039c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

View file

@ -85,12 +85,7 @@ sub debug {
# nixpkgs.system
my ($status, @systemLines) = runCommand("@nixInstantiate@ --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;";
push @attrs, "nixpkgs.hostPlatform = lib.mkDefault \"@system@\";";
my $cpuinfo = read_file "/proc/cpuinfo";

View file

@ -34,7 +34,7 @@ let
name = "nixos-generate-config";
src = ./nixos-generate-config.pl;
perl = "${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl";
nixInstantiate = "${pkgs.nix}/bin/nix-instantiate";
system = pkgs.stdenv.hostPlatform.system;
detectvirt = "${config.systemd.package}/bin/systemd-detect-virt";
btrfs = "${pkgs.btrfs-progs}/bin/btrfs";
inherit (config.system.nixos-generate-config) configuration desktopConfiguration;