diff options
author | rnhmjoj <rnhmjoj@inventati.org> | 2021-02-18 19:14:00 +0100 |
---|---|---|
committer | rnhmjoj <rnhmjoj@inventati.org> | 2021-02-19 09:26:13 +0100 |
commit | 8e59a682a5e937b4ad6f1246ca59196b8558446d (patch) | |
tree | 26d5acd79b1f2ec1c0512da9f41605e1bc891593 /nixos/modules/services/hardware/udev.nix | |
parent | 65325292da4b653fa5cae1dd8a0547015cfc0205 (diff) | |
download | nixpkgs-8e59a682a5e937b4ad6f1246ca59196b8558446d.tar nixpkgs-8e59a682a5e937b4ad6f1246ca59196b8558446d.tar.gz nixpkgs-8e59a682a5e937b4ad6f1246ca59196b8558446d.tar.bz2 nixpkgs-8e59a682a5e937b4ad6f1246ca59196b8558446d.tar.lz nixpkgs-8e59a682a5e937b4ad6f1246ca59196b8558446d.tar.xz nixpkgs-8e59a682a5e937b4ad6f1246ca59196b8558446d.tar.zst nixpkgs-8e59a682a5e937b4ad6f1246ca59196b8558446d.zip |
nixos/udev: add option to install rules in initrd
Note: this moves the example rule used to rename network interfaces in the new udev.initrdRules option, which is required since 115cdd1c.
Diffstat (limited to 'nixos/modules/services/hardware/udev.nix')
-rw-r--r-- | nixos/modules/services/hardware/udev.nix | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix index 63027f7744d..d48b5444677 100644 --- a/nixos/modules/services/hardware/udev.nix +++ b/nixos/modules/services/hardware/udev.nix @@ -202,13 +202,27 @@ in ''; }; - extraRules = mkOption { + initrdRules = mkOption { default = ""; example = '' SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1D:60:B9:6D:4F", KERNEL=="eth*", NAME="my_fast_network_card" ''; type = types.lines; description = '' + <command>udev</command> rules to include in the initrd + <emphasis>only</emphasis>. They'll be written into file + <filename>99-local.rules</filename>. Thus they are read and applied + after the essential initrd rules. + ''; + }; + + extraRules = mkOption { + default = ""; + example = '' + ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="0825", ENV{PULSE_IGNORE}="1" + ''; + type = types.lines; + description = '' Additional <command>udev</command> rules. They'll be written into file <filename>99-local.rules</filename>. Thus they are read and applied after all other rules. @@ -284,6 +298,13 @@ in boot.kernelParams = mkIf (!config.networking.usePredictableInterfaceNames) [ "net.ifnames=0" ]; + boot.initrd.extraUdevRulesCommands = optionalString (cfg.initrdRules != "") + '' + cat <<'EOF' > $out/99-local.rules + ${cfg.initrdRules} + EOF + ''; + environment.etc = { "udev/rules.d".source = udevRules; |