Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1# udevCheckHook {#udevcheckhook} 2 3The `udevCheckHook` derivation adds `udevCheckPhase` to the [`preInstallCheckHooks`](#ssec-installCheck-phase), 4which finds all udev rules in all outputs and verifies them using `udevadm verify --resolve-names=never --no-style`. 5It should be used in any package that has udev rules outputs to ensure the rules are and stay valid. 6 7The hook runs in `installCheckPhase`, requiring `doInstallCheck` is enabled for the hook to take effect: 8```nix 9{ 10 lib, 11 stdenv, 12 udevCheckHook, 13# ... 14}: 15 16stdenv.mkDerivation (finalAttrs: { 17 # ... 18 19 nativeInstallCheckInputs = [ udevCheckHook ]; 20 doInstallCheck = true; 21 22 # ... 23}) 24``` 25Note that for [`buildPythonPackage`](#buildpythonpackage-function) and [`buildPythonApplication`](#buildpythonapplication-function), `doInstallCheck` is enabled by default. 26 27All outputs are scanned for their `/{etc,lib}/udev/rules.d` paths. 28If no rule output is found, the hook is basically a no-op. 29 30The `udevCheckHook` adds a dependency on `systemdMinimal`. 31It is internally guarded behind `hostPlatform` supporting udev and `buildPlatform` being able to execute `udevadm`. 32The hook does not need explicit platform checks in the places where it is used. 33 34The hook can be disabled using `dontUdevCheck`, which is necessary if you want to run some different task in `installCheckPhase` on a package with broken udev rule outputs.