diff --git a/modules/nixos/networking/default.nix b/modules/nixos/networking/default.nix index 2ebe00a..edd8285 100644 --- a/modules/nixos/networking/default.nix +++ b/modules/nixos/networking/default.nix @@ -2,6 +2,7 @@ { imports = [ ./broadcom.nix + ./initrd.nix ./intel.nix ]; diff --git a/modules/nixos/networking/initrd.nix b/modules/nixos/networking/initrd.nix new file mode 100644 index 0000000..2c53a2a --- /dev/null +++ b/modules/nixos/networking/initrd.nix @@ -0,0 +1,21 @@ +{ lib, config, ... }: +let + facterLib = import ../../../lib/lib.nix lib; + + inherit (config.facter) report; +in +{ + options.facter.detected.boot.initrd.networking.kernelModules = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = facterLib.stringSet ( + facterLib.collectDrivers (report.hardware.network_controller or [ ]) + ); + description = '' + List of kernel modules to include in the initrd to support networking. + ''; + }; + + config = lib.mkIf config.boot.initrd.network.enable { + boot.initrd.kernelModules = config.facter.detected.boot.initrd.networking.kernelModules; + }; +}