diff --git a/nixos/modules/hardware/facter/disk.nix b/nixos/modules/hardware/facter/disk.nix index 4bb76f16366d..4158bd171bb9 100644 --- a/nixos/modules/hardware/facter/disk.nix +++ b/nixos/modules/hardware/facter/disk.nix @@ -22,7 +22,7 @@ in ''; }; - config = { + config = lib.mkIf (config.hardware.facter.reportPath != null) { boot.initrd.availableKernelModules = config.hardware.facter.detected.boot.disk.kernelModules; }; } diff --git a/nixos/modules/hardware/facter/firmware.nix b/nixos/modules/hardware/facter/firmware.nix index 10962018890c..b614cab85253 100644 --- a/nixos/modules/hardware/facter/firmware.nix +++ b/nixos/modules/hardware/facter/firmware.nix @@ -8,7 +8,7 @@ let hasIntelCpu = facterLib.hasIntelCpu report; in { - config = lib.mkIf isBaremetal { + config = lib.mkIf (config.hardware.facter.reportPath != null && isBaremetal) { # none (e.g. bare-metal) # provide firmware for devices that might not have been detected by nixos-facter hardware.enableRedistributableFirmware = lib.mkDefault true; diff --git a/nixos/modules/hardware/facter/graphics/amd.nix b/nixos/modules/hardware/facter/graphics/amd.nix index 666868035c3d..b2ec114677a0 100644 --- a/nixos/modules/hardware/facter/graphics/amd.nix +++ b/nixos/modules/hardware/facter/graphics/amd.nix @@ -12,7 +12,7 @@ in defaultText = "hardware dependent"; }; }; - config = lib.mkIf cfg.enable { + config = lib.mkIf (config.hardware.facter.reportPath != null && cfg.enable) { services.xserver.videoDrivers = [ "modesetting" ]; }; } diff --git a/nixos/modules/hardware/facter/graphics/default.nix b/nixos/modules/hardware/facter/graphics/default.nix index cdb987e0d46e..cd29040ce67d 100644 --- a/nixos/modules/hardware/facter/graphics/default.nix +++ b/nixos/modules/hardware/facter/graphics/default.nix @@ -28,7 +28,7 @@ in }; }; - config = lib.mkIf cfg.enable ( + config = lib.mkIf (config.hardware.facter.reportPath != null && cfg.enable) ( { boot.initrd.kernelModules = config.hardware.facter.detected.boot.graphics.kernelModules; } diff --git a/nixos/modules/hardware/facter/keyboard.nix b/nixos/modules/hardware/facter/keyboard.nix index d19e17cd6901..62baf5bd32f1 100644 --- a/nixos/modules/hardware/facter/keyboard.nix +++ b/nixos/modules/hardware/facter/keyboard.nix @@ -15,7 +15,7 @@ in ''; }; - config = { + config = lib.mkIf (config.hardware.facter.reportPath != null) { boot.initrd.availableKernelModules = config.hardware.facter.detected.boot.keyboard.kernelModules; }; } diff --git a/nixos/modules/hardware/facter/networking/default.nix b/nixos/modules/hardware/facter/networking/default.nix index dfbc54c8396d..7f662d8785a0 100644 --- a/nixos/modules/hardware/facter/networking/default.nix +++ b/nixos/modules/hardware/facter/networking/default.nix @@ -60,10 +60,12 @@ in ]; }; }; - config = lib.mkIf config.hardware.facter.detected.dhcp.enable { - networking.useDHCP = lib.mkDefault true; + config = + lib.mkIf (config.hardware.facter.reportPath != null && config.hardware.facter.detected.dhcp.enable) + { + networking.useDHCP = lib.mkDefault true; - # Per-interface DHCP configuration - networking.interfaces = perInterfaceConfig; - }; + # Per-interface DHCP configuration + networking.interfaces = perInterfaceConfig; + }; } diff --git a/nixos/modules/hardware/facter/networking/initrd.nix b/nixos/modules/hardware/facter/networking/initrd.nix index 56be802b7cd9..8c3135354f93 100644 --- a/nixos/modules/hardware/facter/networking/initrd.nix +++ b/nixos/modules/hardware/facter/networking/initrd.nix @@ -14,7 +14,7 @@ in ''; }; - config = lib.mkIf config.boot.initrd.network.enable { + config = lib.mkIf (config.hardware.facter.reportPath != null && config.boot.initrd.network.enable) { boot.initrd.kernelModules = config.hardware.facter.detected.boot.initrd.networking.kernelModules; }; } diff --git a/nixos/modules/hardware/facter/networking/intel.nix b/nixos/modules/hardware/facter/networking/intel.nix index 4ae693a3c636..a28e8ecf580d 100644 --- a/nixos/modules/hardware/facter/networking/intel.nix +++ b/nixos/modules/hardware/facter/networking/intel.nix @@ -49,7 +49,7 @@ in }; }; - config = { + config = lib.mkIf (config.hardware.facter.reportPath != null) { networking.enableIntel2200BGFirmware = lib.mkIf cfg._2200BG.enable (lib.mkDefault true); hardware.enableRedistributableFirmware = lib.mkIf cfg._3945ABG.enable (lib.mkDefault true); }; diff --git a/nixos/modules/hardware/facter/system.nix b/nixos/modules/hardware/facter/system.nix index ef51b0e44f1d..32648f7d07e4 100644 --- a/nixos/modules/hardware/facter/system.nix +++ b/nixos/modules/hardware/facter/system.nix @@ -6,7 +6,7 @@ }: { # Skip setting hostPlatform if it's read-only - nixpkgs = + config.nixpkgs = lib.optionalAttrs (config.hardware.facter.report.system or null != null && !options.nixpkgs.hostPlatform.readOnly) { diff --git a/nixos/modules/hardware/facter/virtualisation.nix b/nixos/modules/hardware/facter/virtualisation.nix index 15cf6bab5aee..9f418ecf3488 100644 --- a/nixos/modules/hardware/facter/virtualisation.nix +++ b/nixos/modules/hardware/facter/virtualisation.nix @@ -51,7 +51,7 @@ in }; }; - config = { + config = lib.mkIf (config.hardware.facter.reportPath != null) { # KVM support boot.kernelModules =