2025-05-16 15:37:55 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
makeSetupHook,
|
|
|
|
systemdMinimal,
|
2025-05-21 13:44:58 +02:00
|
|
|
stdenv,
|
2025-05-16 15:37:55 +02:00
|
|
|
}:
|
2025-05-21 13:44:58 +02:00
|
|
|
let
|
|
|
|
# udev rules can only be checked if systemd (specifically, 'udevadm') can be executed on build platform
|
2025-05-31 18:08:09 +02:00
|
|
|
# If cross-compiling linux -> non-linux, udev rules are still checked, even if they end up being unused.
|
|
|
|
# This is not a problem:
|
|
|
|
# - If there are no udev rules, the hook is a noop
|
|
|
|
# - If the udev rules are broken, they should be flagged as such
|
|
|
|
# - if rules are not needed on a target platform where they are broken, they should be deleted from package output
|
|
|
|
applyHook = lib.meta.availableOn stdenv.buildPlatform systemdMinimal;
|
2025-05-21 13:44:58 +02:00
|
|
|
in
|
2025-05-16 15:37:55 +02:00
|
|
|
makeSetupHook {
|
|
|
|
name = "udev-check-hook";
|
|
|
|
substitutions = {
|
2025-05-21 13:44:58 +02:00
|
|
|
udevadm = if applyHook then lib.getExe' systemdMinimal "udevadm" else "";
|
2025-05-16 15:37:55 +02:00
|
|
|
};
|
|
|
|
meta = {
|
2025-07-23 04:23:40 +00:00
|
|
|
description = "Check validity of udev rules in outputs";
|
2025-05-16 15:37:55 +02:00
|
|
|
maintainers = with lib.maintainers; [ grimmauld ];
|
|
|
|
};
|
|
|
|
} ./hook.sh
|