15 boot.modprobeConfig.enable =
16 mkEnableOption "modprobe config. This is useful for systems like containers which do not require a kernel"
21 boot.modprobeConfig.useUbuntuModuleBlacklist =
22 mkEnableOption "Ubuntu distro's module blacklist"
27 boot.blacklistedKernelModules = mkOption {
28 type = types.listOf types.str;
35 List of names of kernel modules that should not be loaded
36 automatically by the hardware probing code.
40 boot.extraModprobeConfig = mkOption {
43 options parport_pc io=0x378 irq=7 dma=1
46 Any additional configuration to be appended to the generated
47 {file}`modprobe.conf`. This is typically used to
48 specify module options. See
49 {manpage}`modprobe.d(5)` for details.
58 config = mkIf config.boot.modprobeConfig.enable {
60 environment.etc."modprobe.d/ubuntu.conf" =
61 mkIf config.boot.modprobeConfig.useUbuntuModuleBlacklist
63 source = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf";
66 environment.etc."modprobe.d/nixos.conf".text = ''
67 ${flip concatMapStrings config.boot.blacklistedKernelModules (name: ''
70 ${config.boot.extraModprobeConfig}
72 environment.etc."modprobe.d/debian.conf".source = pkgs.kmod-debian-aliases;
74 environment.etc."modprobe.d/systemd.conf".source =
75 "${config.systemd.package}/lib/modprobe.d/systemd.conf";
77 environment.systemPackages = [ pkgs.kmod ];
79 system.activationScripts.modprobe = stringAfter [ "specialfs" ] ''
80 # Allow the kernel to find our wrapped modprobe (which searches
81 # in the right location in the Nix store for kernel modules).
82 # We need this when the kernel (or some module) auto-loads a
84 echo ${pkgs.kmod}/bin/modprobe > /proc/sys/kernel/modprobe