Skip to content

Commit 5b99c79

Browse files
authored
nixos/udev: verify udev rules with udevadm (#406284)
2 parents 6646f61 + b7fe0a1 commit 5b99c79

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

nixos/modules/services/hardware/udev.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ let
5555
preferLocalBuild = true;
5656
allowSubstitutes = false;
5757
packages = lib.unique (map toString udevPackages);
58+
59+
nativeBuildInputs = [
60+
# We only include the out output here to avoid needing to include all
61+
# other outputs in the installer tests as well
62+
# We only need the udevadm command anyway
63+
pkgs.systemdMinimal.out
64+
];
5865
}
5966
''
6067
mkdir -p $out
@@ -147,6 +154,11 @@ let
147154
exit 1
148155
fi
149156
157+
# Verify all the udev rules
158+
echo "Verifying udev rules using udevadm verify..."
159+
udevadm verify --resolve-names=never --no-style $out
160+
echo "OK"
161+
150162
# If auto-configuration is disabled, then remove
151163
# udev's 80-drivers.rules file, which contains rules for
152164
# automatically calling modprobe.

nixos/tests/installer.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ let
681681
{
682682
# The configuration of the system used to run "nixos-install".
683683
installer =
684-
{ config, ... }:
684+
{ config, pkgs, ... }:
685685
{
686686
imports = [
687687
commonConfig
@@ -740,6 +740,11 @@ let
740740
xorg.lndir
741741
shellcheck-minimal
742742

743+
# Only the out output is included here, which is what is
744+
# required to build the NixOS udev rules
745+
# See the comment in services/hardware/udev.nix
746+
systemdMinimal.out
747+
743748
# add curl so that rather than seeing the test attempt to download
744749
# curl's tarball, we see what it's trying to download
745750
curl

0 commit comments

Comments
 (0)