nixos/nixos-generate-config.pl: use modulesPath instead of <nixpkgs>

For imports, it is better to use ‘modulesPath’ than rely on <nixpkgs>
being correctly set. Some users may not have <nixpkgs> set correctly.
In addition, when ‘pure-eval=true’, <nixpkgs> is unset.
This commit is contained in:
Matthew Bauer 2020-04-20 09:57:17 -05:00
parent 10100a97c8
commit c45295d47e

View file

@ -180,7 +180,7 @@ sub pciCheck {
) )
{
# we need e.g. brcmfmac43602-pcie.bin
push @imports, "<nixpkgs/nixos/modules/hardware/network/broadcom-43xx.nix>";
push @imports, "(modulesPath + \"/hardware/network/broadcom-43xx.nix\")";
}
# Can't rely on $module here, since the module may not be loaded
@ -279,7 +279,7 @@ if ($virt eq "oracle") {
# Likewise for QEMU.
if ($virt eq "qemu" || $virt eq "kvm" || $virt eq "bochs") {
push @imports, "<nixpkgs/nixos/modules/profiles/qemu-guest.nix>";
push @imports, "(modulesPath + \"/profiles/qemu-guest.nix\")";
}
# Also for Hyper-V.
@ -296,7 +296,7 @@ if ($virt eq "systemd-nspawn") {
# Provide firmware for devices that are not detected by this script,
# unless we're in a VM/container.
push @imports, "<nixpkgs/nixos/modules/installer/scan/not-detected.nix>"
push @imports, "(modulesPath + \"/installer/scan/not-detected.nix\")"
if $virt eq "none";
@ -549,7 +549,7 @@ my $hwConfig = <<EOF;
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, modulesPath, ... }:
{
imports =${\multiLineList(" ", @imports)};