nixos/nixos-generate-config: use hostPlatform.system instead of calling nix

This commit is contained in:
name_snrl 2023-04-26 23:51:48 +05:00
parent 136f6ccdc8
commit 1aa8534f3e
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;