1 { config, lib, pkgs, ... }:
10 boot.modprobeConfig.enable = mkEnableOption "modprobe config. This is useful for systems like containers which do not require a kernel" // {
14 boot.blacklistedKernelModules = mkOption {
15 type = types.listOf types.str;
17 example = [ "cirrusfb" "i2c_piix4" ];
19 List of names of kernel modules that should not be loaded
20 automatically by the hardware probing code.
24 boot.extraModprobeConfig = mkOption {
28 options parport_pc io=0x378 irq=7 dma=1
31 Any additional configuration to be appended to the generated
32 {file}`modprobe.conf`. This is typically used to
33 specify module options. See
34 {manpage}`modprobe.d(5)` for details.
44 config = mkIf config.boot.modprobeConfig.enable {
46 environment.etc."modprobe.d/ubuntu.conf".source = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf";
48 environment.etc."modprobe.d/nixos.conf".text =
50 ${flip concatMapStrings config.boot.blacklistedKernelModules (name: ''
53 ${config.boot.extraModprobeConfig}
55 environment.etc."modprobe.d/debian.conf".source = pkgs.kmod-debian-aliases;
57 environment.etc."modprobe.d/systemd.conf".source = "${config.systemd.package}/lib/modprobe.d/systemd.conf";
59 environment.systemPackages = [ pkgs.kmod ];
61 system.activationScripts.modprobe = stringAfter ["specialfs"]
63 # Allow the kernel to find our wrapped modprobe (which searches
64 # in the right location in the Nix store for kernel modules).
65 # We need this when the kernel (or some module) auto-loads a
67 echo ${pkgs.kmod}/bin/modprobe > /proc/sys/kernel/modprobe