at 18.09-beta 1.8 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5{ 6 7 ###### interface 8 9 options = { 10 11 boot.blacklistedKernelModules = mkOption { 12 type = types.listOf types.str; 13 default = []; 14 example = [ "cirrusfb" "i2c_piix4" ]; 15 description = '' 16 List of names of kernel modules that should not be loaded 17 automatically by the hardware probing code. 18 ''; 19 }; 20 21 boot.extraModprobeConfig = mkOption { 22 default = ""; 23 example = 24 '' 25 options parport_pc io=0x378 irq=7 dma=1 26 ''; 27 description = '' 28 Any additional configuration to be appended to the generated 29 <filename>modprobe.conf</filename>. This is typically used to 30 specify module options. See 31 <citerefentry><refentrytitle>modprobe.conf</refentrytitle> 32 <manvolnum>5</manvolnum></citerefentry> for details. 33 ''; 34 type = types.lines; 35 }; 36 37 }; 38 39 40 ###### implementation 41 42 config = mkIf (!config.boot.isContainer) { 43 44 environment.etc."modprobe.d/ubuntu.conf".source = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; 45 46 environment.etc."modprobe.d/nixos.conf".text = 47 '' 48 ${flip concatMapStrings config.boot.blacklistedKernelModules (name: '' 49 blacklist ${name} 50 '')} 51 ${config.boot.extraModprobeConfig} 52 ''; 53 environment.etc."modprobe.d/debian.conf".source = pkgs.kmod-debian-aliases; 54 55 environment.systemPackages = [ pkgs.kmod ]; 56 57 system.activationScripts.modprobe = stringAfter ["specialfs"] 58 '' 59 # Allow the kernel to find our wrapped modprobe (which searches 60 # in the right location in the Nix store for kernel modules). 61 # We need this when the kernel (or some module) auto-loads a 62 # module. 63 echo ${pkgs.kmod}/bin/modprobe > /proc/sys/kernel/modprobe 64 ''; 65 66 }; 67 68}