summary refs log tree commit diff
path: root/nixos/modules/services/hardware/udev.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-05-22 14:42:25 +0200
committerFlorian Klink <flokli@flokli.de>2020-05-22 14:43:58 +0200
commitd64d42e023f99ae592bc7ccd6298d66a657aa8ea (patch)
tree3a318a7865ce23c748aaa1cd8e96bfbf86f33281 /nixos/modules/services/hardware/udev.nix
parent8cbf8116e7b9bf74b32a8f7bba39f83d1047dcad (diff)
downloadnixpkgs-d64d42e023f99ae592bc7ccd6298d66a657aa8ea.tar
nixpkgs-d64d42e023f99ae592bc7ccd6298d66a657aa8ea.tar.gz
nixpkgs-d64d42e023f99ae592bc7ccd6298d66a657aa8ea.tar.bz2
nixpkgs-d64d42e023f99ae592bc7ccd6298d66a657aa8ea.tar.lz
nixpkgs-d64d42e023f99ae592bc7ccd6298d66a657aa8ea.tar.xz
nixpkgs-d64d42e023f99ae592bc7ccd6298d66a657aa8ea.tar.zst
nixpkgs-d64d42e023f99ae592bc7ccd6298d66a657aa8ea.zip
nixos/udev: support /run/current-system/systemd in udevRules
https://github.com/NixOS/nixpkgs/pull/88492 flipped some references to
systemctl from config.systemd.package to /run/current-system/systemd/,
which udevRules obviously isn't able resolve.

If we encounter such references, replace them with
config.systemd.package before doing the check.
Diffstat (limited to 'nixos/modules/services/hardware/udev.nix')
-rw-r--r--nixos/modules/services/hardware/udev.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix
index 168056a475e..587b9b0234a 100644
--- a/nixos/modules/services/hardware/udev.nix
+++ b/nixos/modules/services/hardware/udev.nix
@@ -83,6 +83,10 @@ let
       run_progs=$(grep -v '^[[:space:]]*#' $out/* | grep 'RUN+="/' |
         sed -e 's/.*RUN+="\([^ "]*\)[ "].*/\1/' | uniq)
       for i in $import_progs $run_progs; do
+        # if the path refers to /run/current-system/systemd, replace with config.systemd.package
+        if [[ $i == /run/current-system/systemd* ]]; then
+          i="${config.systemd.package}/''${i#/run/current-system/systemd/}"
+        fi
         if [[ ! -x $i ]]; then
           echo "FAIL"
           echo "$i is called in udev rules but is not executable or does not exist"