From 9f2a61c59cc4e4ce278e6582cb4bdca9c2088755 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 3 Feb 2016 14:45:19 +0100 Subject: nixos/udev: Add an option to fail on FHS paths So far we were merely printing a warning if there are still references to (/usr)/s?bin, but we actually want to make sure that we fix those paths, especially on updates of packages that come with udev rules. This adds a new option allowImpurePaths, which when set to false will cause the "udev-rules" derivation to fail. I've set this to true by default, to not break existing systems too much and the intention is to set it to false for a few NixOS VM tests. Signed-off-by: aszlig --- nixos/modules/services/hardware/udev.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'nixos') diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix index dc87c9215e65..74ec335c7509 100644 --- a/nixos/modules/services/hardware/udev.nix +++ b/nixos/modules/services/hardware/udev.nix @@ -116,6 +116,7 @@ let )" echo "$localFile ($remoteFile) contains references to $refs." done + ${optionalString (!cfg.allowImpurePaths) "exit 1"} fi ${optionalString config.networking.usePredictableInterfaceNames '' @@ -231,6 +232,20 @@ in ''; }; + allowImpurePaths = mkOption { + default = true; + example = false; + type = types.bool; + description = '' + If this is disabled, the build will fail whenever one of the + udev rules contains a reference to + /usr/bin, /usr/sbin, + /bin or /sbin. + + By default only a warning is printed during build. + ''; + }; + }; hardware.firmware = mkOption { -- cgit 1.4.1