check-meta: add allowBrokenPredicate (#340081)
This commit is contained in:
@@ -31,7 +31,7 @@ Most unfree licenses prohibit either executing or distributing the software.
|
|||||||
|
|
||||||
## Installing broken packages {#sec-allow-broken}
|
## Installing broken packages {#sec-allow-broken}
|
||||||
|
|
||||||
There are two ways to try compiling a package which has been marked as broken.
|
There are several ways to try compiling a package which has been marked as broken.
|
||||||
|
|
||||||
- For allowing the build of a broken package once, you can use an environment variable for a single invocation of the nix tools:
|
- For allowing the build of a broken package once, you can use an environment variable for a single invocation of the nix tools:
|
||||||
|
|
||||||
@@ -39,7 +39,15 @@ There are two ways to try compiling a package which has been marked as broken.
|
|||||||
$ export NIXPKGS_ALLOW_BROKEN=1
|
$ export NIXPKGS_ALLOW_BROKEN=1
|
||||||
```
|
```
|
||||||
|
|
||||||
- For permanently allowing broken packages to be built, you may add `allowBroken = true;` to your user's configuration file, like this:
|
- For permanently allowing broken packages that match some condition to be built, you may add `allowBrokenPredicate` to your user's configuration file with the desired condition, for example:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
allowBrokenPredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [ "hello" ];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- For permanently allowing all broken packages to be built, you may add `allowBroken = true;` to your user's configuration file, like this:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ allowBroken = true; }
|
{ allowBroken = true; }
|
||||||
|
|||||||
@@ -125,6 +125,18 @@ let
|
|||||||
|
|
||||||
isMarkedBroken = attrs: attrs.meta.broken or false;
|
isMarkedBroken = attrs: attrs.meta.broken or false;
|
||||||
|
|
||||||
|
# Allow granular checks to allow only some broken packages
|
||||||
|
# Example:
|
||||||
|
# { pkgs, ... }:
|
||||||
|
# {
|
||||||
|
# allowBroken = false;
|
||||||
|
# allowBrokenPredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [ "hello" ];
|
||||||
|
# }
|
||||||
|
allowBrokenPredicate = config.allowBrokenPredicate or (x: false);
|
||||||
|
|
||||||
|
hasDeniedBroken =
|
||||||
|
attrs: (attrs.meta.broken or false) && !allowBroken && !allowBrokenPredicate attrs;
|
||||||
|
|
||||||
hasUnsupportedPlatform = pkg: !(availableOn hostPlatform pkg);
|
hasUnsupportedPlatform = pkg: !(availableOn hostPlatform pkg);
|
||||||
|
|
||||||
isMarkedInsecure = attrs: (attrs.meta.knownVulnerabilities or [ ]) != [ ];
|
isMarkedInsecure = attrs: (attrs.meta.knownVulnerabilities or [ ]) != [ ];
|
||||||
@@ -516,7 +528,7 @@ let
|
|||||||
reason = "non-source";
|
reason = "non-source";
|
||||||
errormsg = "contains elements not built from source (‘${showSourceType attrs.meta.sourceProvenance}’)";
|
errormsg = "contains elements not built from source (‘${showSourceType attrs.meta.sourceProvenance}’)";
|
||||||
}
|
}
|
||||||
else if !allowBroken && attrs.meta.broken or false then
|
else if hasDeniedBroken attrs then
|
||||||
{
|
{
|
||||||
valid = "no";
|
valid = "no";
|
||||||
reason = "broken";
|
reason = "broken";
|
||||||
|
|||||||
Reference in New Issue
Block a user