* Allow modules to add packages to the $PATH seen by programs called
from udev rules. This is slightly tricky because udev has a 512-character limit on environment variables, so we create a symlink tree to work around this. svn path=/nixos/trunk/; revision=23822
This commit is contained in:
parent
dc8eff071a
commit
82f97b5fb2
|
@ -38,7 +38,7 @@ let
|
||||||
cp -v ${udev}/libexec/rules.d/*.rules $out/
|
cp -v ${udev}/libexec/rules.d/*.rules $out/
|
||||||
|
|
||||||
# Set a reasonable $PATH for programs called by udev rules.
|
# Set a reasonable $PATH for programs called by udev rules.
|
||||||
echo 'ENV{PATH}="${pkgs.coreutils}/bin:${pkgs.gnused}/bin:${pkgs.utillinux}/bin"' > $out/00-path.rules
|
echo 'ENV{PATH}="${udevPath}/bin:${udevPath}/sbin"' > $out/00-path.rules
|
||||||
|
|
||||||
# Set the firmware search path so that the firmware.sh helper
|
# Set the firmware search path so that the firmware.sh helper
|
||||||
# called by 50-firmware.rules works properly.
|
# called by 50-firmware.rules works properly.
|
||||||
|
@ -84,6 +84,15 @@ let
|
||||||
#udev_log="debug"
|
#udev_log="debug"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Udev has a 512-character limit for ENV{PATH}, so create a symlink
|
||||||
|
# tree to work around this.
|
||||||
|
udevPath = pkgs.buildEnv {
|
||||||
|
name = "udev-path";
|
||||||
|
paths = cfg.path;
|
||||||
|
pathsToLink = [ "/bin" "/sbin" ];
|
||||||
|
ignoreCollisions = true;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -118,6 +127,15 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
path = mkOption {
|
||||||
|
default = [];
|
||||||
|
merge = mergeListOption;
|
||||||
|
description = ''
|
||||||
|
Packages added to the <envar>PATH</envar> environment variable when
|
||||||
|
executing programs from Udev rules.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraRules = mkOption {
|
extraRules = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
example = ''
|
example = ''
|
||||||
|
@ -159,7 +177,9 @@ in
|
||||||
|
|
||||||
services.udev.extraRules = nixosRules;
|
services.udev.extraRules = nixosRules;
|
||||||
|
|
||||||
services.udev.packages = [extraUdevRules];
|
services.udev.packages = [ extraUdevRules ];
|
||||||
|
|
||||||
|
services.udev.path = [ pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.utillinux ];
|
||||||
|
|
||||||
jobs.udev =
|
jobs.udev =
|
||||||
{ startOn = "startup";
|
{ startOn = "startup";
|
||||||
|
@ -207,7 +227,7 @@ in
|
||||||
initctl emit -n new-devices
|
initctl emit -n new-devices
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue