Hello all,
I’m trying to create a custom udev rule. I already have the rule itself in a text file. The canonical way to do this seems to be to define the rule as a derivation, say xilinx_udev_rules
, then to add it to configuration.nix
with services.udev.packages = [ xilinx_udev_rules ];
. I’ve tried this, borrowing from a few working examples here and there, but without success. I have a fairly minimal derivation:
pkgs.stdenv.mkDerivation {
name = "xilinx-udev-rules";
src = ./rules/.;
dontBuild = true;
dontConfigure = true;
installPhase = ''
mkdir -p $out/lib/udev/rules.d
cp 52-xilinx-digilent-usb.rules $out/lib/udev/rules.d
'';
}
The relevant sections of my configuration.nix
are
let
udevRules = pkgs.callPackage ./udev/default.nix { inherit pkgs; };
in {
services.udev.packages = [ udevRules ];
}
where ./udev/default.nix
is the derivation defined above.
If I then do nixos-rebuild it seems to make some progress but then hits me with
/nix/store/qqmw740w7ra8s7yqa7lxg92pibx93mbv-udev-rules/52-xilinx-digilent-usb.rules (originally from /nix/store/yjf7lwr0yb60rf2qw5aq0sqlx91vr9nl-xilinx-udev-rules/lib/udev/rules.d/52-xilinx-
digilent-usb.rules) contains references to /sbin/udevcontrol.
builder for '/nix/store/yw3xil18qr9v5hy80nbj1kpx7yyfcbsg-udev-rules.drv' failed with exit code 1
I’m not sure how I’m getting this wrong since I’ve copied almost all of this from some working examples. Could it be that the derivation is local? It will build OK using nix-build
, outside of nixos-rebuild
.
Any help gratefully received.