From 2b6554b5194c93d5cff4d5165f879f201349b32a Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Wed, 1 Apr 2009 20:28:04 +0000 Subject: [PATCH] allow specifying custom udev rules in /etc/nixos/configuration.nix svn path=/nixos/branches/fix-style/; revision=14826 --- upstart-jobs/udev.nix | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/upstart-jobs/udev.nix b/upstart-jobs/udev.nix index 4765f29176e6..30fc42791715 100644 --- a/upstart-jobs/udev.nix +++ b/upstart-jobs/udev.nix @@ -22,10 +22,21 @@ let addUdevPkgs = mkOption { default = []; description = " - List of packages containing udev rules. + List of packages containing udev rules. All files found in $out/*/udev/rules.d/*.rules will be recognized "; merge = pkgs.lib.mergeListOption; }; + + extraRules = mkOption { + default = ""; + example = '' + KERNEL=="eth*", ATTR{address}=="00:1D:60:B9:6D:4F", NAME="my_fast_network_card" + ''; + description = " + Add custom rules. They'll be written into file 10-local.rules. + Thus they are read before all other rules. + "; + }; sndMode = mkOption { default = "0600"; @@ -58,7 +69,13 @@ let }; firmwareDirs = config.services.udev.addFirmware; - extraUdevPkgs = config.services.udev.addUdevPkgs; + extraUdevPkgs = config.services.udev.addUdevPkgs + ++ pkgs.lib.optional (cfg.extraRules != "") + (pkgs.writeTextFile { + name = "extra-udev-rules"; + text = cfg.extraRules; + destination = "/custom/udev/rules.d/10-local.rules"; + }); modprobe = config.system.sbin.modprobe;