allow specifying custom udev rules in /etc/nixos/configuration.nix

svn path=/nixos/branches/fix-style/; revision=14826
This commit is contained in:
Marc Weber 2009-04-01 20:28:04 +00:00
parent d7fcb32e9b
commit 2b6554b519

View File

@ -22,10 +22,21 @@ let
addUdevPkgs = mkOption { addUdevPkgs = mkOption {
default = []; default = [];
description = " 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; 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 { sndMode = mkOption {
default = "0600"; default = "0600";
@ -58,7 +69,13 @@ let
}; };
firmwareDirs = config.services.udev.addFirmware; 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; modprobe = config.system.sbin.modprobe;