Unverified Commit 76647f3f authored by Ramses's avatar Ramses Committed by GitHub
Browse files

[Backport release-25.05] udevCheckHook: guard platform (#409488)

parents 5e8bb332 abeca9a5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ udevCheckHook() {
    echo Finished udevCheckPhase
}

if [[ -z "${dontUdevCheck-}" ]]; then
if [[ -z "${dontUdevCheck-}" && -n "@udevadm@" ]]; then
    echo "Using udevCheckHook"
    preInstallCheckHooks+=(udevCheckHook)
fi
+10 −2
Original line number Diff line number Diff line
@@ -2,12 +2,20 @@
  lib,
  makeSetupHook,
  systemdMinimal,
  udev,
  stdenv,
}:

let
  # udev rules can only be checked if systemd (specifically, 'udevadm') can be executed on build platform
  # if udev is not available on hostPlatform, there is no point in checking rules
  applyHook =
    lib.meta.availableOn stdenv.hostPlatform udev
    && lib.meta.availableOn stdenv.buildPlatform systemdMinimal;
in
makeSetupHook {
  name = "udev-check-hook";
  substitutions = {
    udevadm = lib.getExe' systemdMinimal "udevadm";
    udevadm = if applyHook then lib.getExe' systemdMinimal "udevadm" else "";
  };
  meta = {
    description = "check validity of udev rules in outputs";