mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 18:23:09 +00:00
* Use most of the default rules from the udev distribution
rather than supplying our own (less maintenance...). This takes care, among other things, of populating /dev/disk, which is useful. svn path=/nixos/trunk/; revision=12246
This commit is contained in:
parent
938c76d5c0
commit
49b9662e31
@ -1,48 +0,0 @@
|
||||
# Miscellaneous devices.
|
||||
KERNEL=="mem|kmem", MODE="0600"
|
||||
KERNEL=="port", MODE="0600"
|
||||
KERNEL=="nvram", MODE="0600"
|
||||
KERNEL=="null", MODE="0666"
|
||||
KERNEL=="zero", MODE="0666"
|
||||
KERNEL=="full", MODE="0622"
|
||||
KERNEL=="random", MODE="0666"
|
||||
KERNEL=="urandom", MODE="0644"
|
||||
KERNEL=="rtc", MODE="0600"
|
||||
KERNEL=="sonypi", MODE="0666"
|
||||
KERNEL=="agpgart", MODE="0600"
|
||||
KERNEL=="kvm", MODE="0666"
|
||||
KERNEL=="fuse", MODE="0666"
|
||||
KERNEL=="tun", NAME="net/%k", MODE="0666"
|
||||
|
||||
|
||||
# TTYs.
|
||||
KERNEL=="tty", NAME="%k", MODE="666", OPTIONS="last_rule" # GROUP="tty"
|
||||
KERNEL=="ptmx", NAME="%k", MODE="666" # GROUP="tty"
|
||||
|
||||
|
||||
# Input devices go under /dev/input.
|
||||
KERNEL=="mouse*|mice", NAME="input/%k", MODE="0640"
|
||||
KERNEL=="event*", NAME="input/%k", MODE="0640"
|
||||
KERNEL=="js*", NAME="input/%k", MODE="0644"
|
||||
KERNEL=="ts*", NAME="input/%k", MODE="0600"
|
||||
KERNEL=="uinput", NAME="input/%k", MODE="0600"
|
||||
|
||||
|
||||
# Create a symlink for the CD-ROM device.
|
||||
KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom cdrom-%k"
|
||||
KERNEL=="sr[0-9]", BUS=="scsi", SYMLINK+="cdrom cdrom-%k"
|
||||
|
||||
|
||||
# ALSA sound devices.
|
||||
KERNEL=="controlC[0-9]*", NAME="snd/%k", MODE="@sndMode@"
|
||||
KERNEL=="hwC[D0-9]*", NAME="snd/%k", MODE="@sndMode@"
|
||||
KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k", MODE="@sndMode@"
|
||||
KERNEL=="midiC[D0-9]*", NAME="snd/%k", MODE="@sndMode@"
|
||||
KERNEL=="timer", NAME="snd/%k", MODE="@sndMode@"
|
||||
KERNEL=="seq", NAME="snd/%k", MODE="@sndMode@"
|
||||
|
||||
KERNEL=="kqemu", NAME="%k", MODE="0666"
|
||||
|
||||
|
||||
# Firmware loading.
|
||||
SUBSYSTEM=="firmware", ACTION=="add", RUN+="@firmwareLoader@"
|
@ -5,30 +5,54 @@
|
||||
|
||||
let
|
||||
|
||||
firmwareLoader = substituteAll {
|
||||
src = ./udev-firmware-loader.sh;
|
||||
path = "${stdenv.coreutils}/bin";
|
||||
isExecutable = true;
|
||||
inherit firmwareDirs;
|
||||
};
|
||||
|
||||
nixRules = writeText "10-nix.rules" ''
|
||||
|
||||
# Miscellaneous devices.
|
||||
KERNEL=="sonypi", MODE="0666"
|
||||
KERNEL=="kvm", MODE="0666"
|
||||
KERNEL=="kqemu", NAME="%k", MODE="0666"
|
||||
|
||||
# Create a symlink for the CD-ROM device.
|
||||
#KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom cdrom-%k"
|
||||
#KERNEL=="sr[0-9]", BUS=="scsi", SYMLINK+="cdrom cdrom-%k"
|
||||
|
||||
# ALSA sound devices.
|
||||
KERNEL=="controlC[0-9]*", NAME="snd/%k", MODE="${sndMode}"
|
||||
KERNEL=="hwC[D0-9]*", NAME="snd/%k", MODE="${sndMode}"
|
||||
KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k", MODE="${sndMode}"
|
||||
KERNEL=="midiC[D0-9]*", NAME="snd/%k", MODE="${sndMode}"
|
||||
KERNEL=="timer", NAME="snd/%k", MODE="${sndMode}"
|
||||
KERNEL=="seq", NAME="snd/%k", MODE="${sndMode}"
|
||||
|
||||
# Firmware loading.
|
||||
SUBSYSTEM=="firmware", ACTION=="add", RUN+="${firmwareLoader}"
|
||||
|
||||
'';
|
||||
|
||||
# Perform substitutions in all udev rules files.
|
||||
udevRules = stdenv.mkDerivation {
|
||||
name = "udev-rules";
|
||||
src = cleanSource ./udev-rules;
|
||||
firmwareLoader = substituteAll {
|
||||
src = ./udev-firmware-loader.sh;
|
||||
path = "${stdenv.coreutils}/bin";
|
||||
isExecutable = true;
|
||||
inherit firmwareDirs;
|
||||
};
|
||||
inherit sndMode;
|
||||
buildCommand = "
|
||||
buildCommand= # urgh
|
||||
#src = cleanSource ./udev-rules;
|
||||
buildCommand = ''
|
||||
ensureDir $out
|
||||
for i in $src/*; do
|
||||
substituteAll $i $out/$(basename $i)
|
||||
done
|
||||
ln -s ${nixRules} $out/${nixRules.name}
|
||||
shopt -s nullglob
|
||||
cp ${udev}/etc/udev/rules.d/50-udev-default.rules $out/
|
||||
cp ${udev}/etc/udev/rules.d/60-persistent-storage.rules $out/
|
||||
cp ${udev}/etc/udev/rules.d/95-udev-late.rules $out/
|
||||
for i in ${toString extraUdevPkgs}; do
|
||||
for j in $i/etc/udev/rules.d/*; do
|
||||
ln -s $j $out/$(basename $j)
|
||||
done
|
||||
done
|
||||
";
|
||||
''; # */
|
||||
};
|
||||
|
||||
# The udev configuration file
|
||||
@ -92,4 +116,5 @@ in
|
||||
respawn ${udev}/sbin/udevd
|
||||
'';
|
||||
|
||||
passthru = {inherit udevRules;};
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ Section "Module"
|
||||
Load "bitmap"
|
||||
Load "int10"
|
||||
Load "vbe"
|
||||
Load "v4l"
|
||||
@moduleSection@
|
||||
@extraModules@
|
||||
EndSection
|
||||
|
@ -41,6 +41,7 @@ let
|
||||
xorg.xorgserver
|
||||
xorg.xf86inputkeyboard
|
||||
xorg.xf86inputmouse
|
||||
xorg.xf86videov4l
|
||||
]
|
||||
++ optional (videoDriver == "vesa") xorg.xf86videovesa
|
||||
++ optional (videoDriver == "vga") xorg.xf86videovga
|
||||
|
Loading…
Reference in New Issue
Block a user