Skip to content

Commit d9305c9

Browse files
authored
udevCheckHook: guard platform (#409385)
2 parents 3e2a078 + 1461a84 commit d9305c9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pkgs/by-name/ud/udevCheckHook/hook.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ udevCheckHook() {
2121
echo Finished udevCheckPhase
2222
}
2323

24-
if [[ -z "${dontUdevCheck-}" ]]; then
24+
if [[ -z "${dontUdevCheck-}" && -n "@udevadm@" ]]; then
2525
echo "Using udevCheckHook"
2626
preInstallCheckHooks+=(udevCheckHook)
2727
fi

pkgs/by-name/ud/udevCheckHook/package.nix

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22
lib,
33
makeSetupHook,
44
systemdMinimal,
5+
udev,
6+
stdenv,
57
}:
6-
8+
let
9+
# udev rules can only be checked if systemd (specifically, 'udevadm') can be executed on build platform
10+
# if udev is not available on hostPlatform, there is no point in checking rules
11+
applyHook =
12+
lib.meta.availableOn stdenv.hostPlatform udev
13+
&& lib.meta.availableOn stdenv.buildPlatform systemdMinimal;
14+
in
715
makeSetupHook {
816
name = "udev-check-hook";
917
substitutions = {
10-
udevadm = lib.getExe' systemdMinimal "udevadm";
18+
udevadm = if applyHook then lib.getExe' systemdMinimal "udevadm" else "";
1119
};
1220
meta = {
1321
description = "check validity of udev rules in outputs";

0 commit comments

Comments
 (0)