summary refs log tree commit diff
path: root/pkgs/stdenv/generic
diff options
context:
space:
mode:
authorArnout Engelen <arnout@bzzt.net>2020-06-05 21:39:08 +0200
committerArnout Engelen <arnout@bzzt.net>2020-11-09 17:26:02 +0100
commitf6650152bdf342456756533c34b9bef32b7b7e24 (patch)
treea297c90389f609d14721da58d252f8865fea959c /pkgs/stdenv/generic
parenta52e974cff8fb80c427e0d55c01b3b8c770ccec4 (diff)
downloadnixpkgs-f6650152bdf342456756533c34b9bef32b7b7e24.tar
nixpkgs-f6650152bdf342456756533c34b9bef32b7b7e24.tar.gz
nixpkgs-f6650152bdf342456756533c34b9bef32b7b7e24.tar.bz2
nixpkgs-f6650152bdf342456756533c34b9bef32b7b7e24.tar.lz
nixpkgs-f6650152bdf342456756533c34b9bef32b7b7e24.tar.xz
nixpkgs-f6650152bdf342456756533c34b9bef32b7b7e24.tar.zst
nixpkgs-f6650152bdf342456756533c34b9bef32b7b7e24.zip
Promote allowUnfreePredicate in remediation message
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r--pkgs/stdenv/generic/check-meta.nix20
1 files changed, 15 insertions, 5 deletions
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix
index b93ea558eac..0ceb60535f5 100644
--- a/pkgs/stdenv/generic/check-meta.nix
+++ b/pkgs/stdenv/generic/check-meta.nix
@@ -80,9 +80,9 @@ let
   pos_str = meta: meta.position or "«unknown-file»";
 
   remediation = {
-    unfree = remediate_whitelist "Unfree";
-    broken = remediate_whitelist "Broken";
-    unsupported = remediate_whitelist "UnsupportedSystem";
+    unfree = remediate_whitelist "Unfree" remediate_unfree_predicate;
+    broken = remediate_whitelist "Broken" (x: "");
+    unsupported = remediate_whitelist "UnsupportedSystem" (x: "");
     blacklisted = x: "";
     insecure = remediate_insecure;
     broken-outputs = remediateOutputsToInstall;
@@ -98,7 +98,17 @@ let
     Broken = "broken packages";
     UnsupportedSystem = "packages that are unsupported for this system";
   }.${allow_attr};
-  remediate_whitelist = allow_attr: attrs:
+  remediate_unfree_predicate = attrs:
+    ''
+
+      Alternatively you can configure a predicate to whitelist specific packages:
+        { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
+            "${lib.getName attrs}"
+          ];
+        }
+    '';
+
+  remediate_whitelist = allow_attr: rebuild_amendment: attrs:
     ''
       a) To temporarily allow ${remediation_phrase allow_attr}, you can use an environment variable
          for a single invocation of the nix tools.
@@ -108,7 +118,7 @@ let
       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allow${allow_attr} = true; }
       in configuration.nix to override this.
-
+      ${rebuild_amendment attrs}
       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allow${allow_attr} = true; }
       to ~/.config/nixpkgs/config.nix.