diff options
author | K900 <me@0upti.me> | 2024-06-22 14:28:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-22 14:28:12 +0300 |
commit | 1374c5801369ae341889ab545be306ec0ffdebbb (patch) | |
tree | 65fa1bf8d3162a2bd503afe123c2aa84a0109e5a /pkgs/stdenv | |
parent | 5e5cd32323fe3d52ade85c6cc3873825055cd9d2 (diff) | |
parent | dbef1af49e1f00227d5d1bb8fd087d14c53ec42f (diff) |
Merge pull request #320370 from eclairevoyant/fix-checkmeta-predicates
check-meta: fix instructions
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/check-meta.nix | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 0bb07b6545450..502343f01fb32 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -46,7 +46,7 @@ let # import <nixpkgs> { config = { showDerivationWarnings = [ "maintainerless" ]; }; } showWarnings = config.showDerivationWarnings; - getName = attrs: attrs.name or ("${attrs.pname or "«name-missing»"}-${attrs.version or "«version-missing»"}"); + getNameWithVersion = attrs: attrs.name or ("${attrs.pname or "«name-missing»"}-${attrs.version or "«version-missing»"}"); allowUnfree = config.allowUnfree || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"; @@ -123,7 +123,7 @@ let !allowUnfree && !allowUnfreePredicate attrs; - allowInsecureDefaultPredicate = x: builtins.elem (getName x) (config.permittedInsecurePackages or []); + allowInsecureDefaultPredicate = x: builtins.elem (getNameWithVersion x) (config.permittedInsecurePackages or []); allowInsecurePredicate = x: (config.allowInsecurePredicate or allowInsecureDefaultPredicate) x; hasAllowedInsecure = attrs: @@ -230,23 +230,23 @@ let $ export NIXPKGS_ALLOW_INSECURE=1 ${flakeNote} - b) for `nixos-rebuild` you can add ‘${lib.getName attrs}’ to + b) for `nixos-rebuild` you can add ‘${getNameWithVersion attrs}’ to `nixpkgs.config.permittedInsecurePackages` in the configuration.nix, like so: { nixpkgs.config.permittedInsecurePackages = [ - "${lib.getName attrs}" + "${getNameWithVersion attrs}" ]; } c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add - ‘${lib.getName attrs}’ to `permittedInsecurePackages` in + ‘${getNameWithVersion attrs}’ to `permittedInsecurePackages` in ~/.config/nixpkgs/config.nix, like so: { permittedInsecurePackages = [ - "${lib.getName attrs}" + "${getNameWithVersion attrs}" ]; } @@ -257,9 +257,9 @@ let actualOutputs = attrs.outputs or [ "out" ]; missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs; in '' - The package ${getName attrs} has set meta.outputsToInstall to: ${builtins.concatStringsSep ", " expectedOutputs} + The package ${getNameWithVersion attrs} has set meta.outputsToInstall to: ${builtins.concatStringsSep ", " expectedOutputs} - however ${getName attrs} only has the outputs: ${builtins.concatStringsSep ", " actualOutputs} + however ${getNameWithVersion attrs} only has the outputs: ${builtins.concatStringsSep ", " actualOutputs} and is missing the following ouputs: @@ -269,9 +269,9 @@ let handleEvalIssue = { meta, attrs }: { reason , errormsg ? "" }: let msg = if inHydra - then "Failed to evaluate ${getName attrs}: «${reason}»: ${errormsg}" + then "Failed to evaluate ${getNameWithVersion attrs}: «${reason}»: ${errormsg}" else '' - Package ‘${getName attrs}’ in ${pos_str meta} ${errormsg}, refusing to evaluate. + Package ‘${getNameWithVersion attrs}’ in ${pos_str meta} ${errormsg}, refusing to evaluate. '' + (builtins.getAttr reason remediation) attrs; @@ -283,8 +283,8 @@ let handleEvalWarning = { meta, attrs }: { reason , errormsg ? "" }: let remediationMsg = (builtins.getAttr reason remediation) attrs; - msg = if inHydra then "Warning while evaluating ${getName attrs}: «${reason}»: ${errormsg}" - else "Package ${getName attrs} in ${pos_str meta} ${errormsg}, continuing anyway." + msg = if inHydra then "Warning while evaluating ${getNameWithVersion attrs}: «${reason}»: ${errormsg}" + else "Package ${getNameWithVersion attrs} in ${pos_str meta} ${errormsg}, continuing anyway." + (optionalString (remediationMsg != "") "\n${remediationMsg}"); isEnabled = findFirst (x: x == reason) null showWarnings; in if isEnabled != null then builtins.trace msg true else true; |