mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
check-meta: rename local binding
This commit is contained in:
parent
396629c7b6
commit
dbef1af49e
1 changed files with 12 additions and 12 deletions
|
@ -46,7 +46,7 @@ let
|
||||||
# import <nixpkgs> { config = { showDerivationWarnings = [ "maintainerless" ]; }; }
|
# import <nixpkgs> { config = { showDerivationWarnings = [ "maintainerless" ]; }; }
|
||||||
showWarnings = config.showDerivationWarnings;
|
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
|
allowUnfree = config.allowUnfree
|
||||||
|| builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1";
|
|| builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1";
|
||||||
|
@ -123,7 +123,7 @@ let
|
||||||
!allowUnfree &&
|
!allowUnfree &&
|
||||||
!allowUnfreePredicate attrs;
|
!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;
|
allowInsecurePredicate = x: (config.allowInsecurePredicate or allowInsecureDefaultPredicate) x;
|
||||||
|
|
||||||
hasAllowedInsecure = attrs:
|
hasAllowedInsecure = attrs:
|
||||||
|
@ -230,23 +230,23 @@ let
|
||||||
|
|
||||||
$ export NIXPKGS_ALLOW_INSECURE=1
|
$ export NIXPKGS_ALLOW_INSECURE=1
|
||||||
${flakeNote}
|
${flakeNote}
|
||||||
b) for `nixos-rebuild` you can add ‘${getName attrs}’ to
|
b) for `nixos-rebuild` you can add ‘${getNameWithVersion attrs}’ to
|
||||||
`nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
|
`nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
|
||||||
like so:
|
like so:
|
||||||
|
|
||||||
{
|
{
|
||||||
nixpkgs.config.permittedInsecurePackages = [
|
nixpkgs.config.permittedInsecurePackages = [
|
||||||
"${getName attrs}"
|
"${getNameWithVersion attrs}"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
|
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
|
||||||
‘${getName attrs}’ to `permittedInsecurePackages` in
|
‘${getNameWithVersion attrs}’ to `permittedInsecurePackages` in
|
||||||
~/.config/nixpkgs/config.nix, like so:
|
~/.config/nixpkgs/config.nix, like so:
|
||||||
|
|
||||||
{
|
{
|
||||||
permittedInsecurePackages = [
|
permittedInsecurePackages = [
|
||||||
"${getName attrs}"
|
"${getNameWithVersion attrs}"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,9 +257,9 @@ let
|
||||||
actualOutputs = attrs.outputs or [ "out" ];
|
actualOutputs = attrs.outputs or [ "out" ];
|
||||||
missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs;
|
missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs;
|
||||||
in ''
|
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:
|
and is missing the following ouputs:
|
||||||
|
|
||||||
|
@ -269,9 +269,9 @@ let
|
||||||
handleEvalIssue = { meta, attrs }: { reason , errormsg ? "" }:
|
handleEvalIssue = { meta, attrs }: { reason , errormsg ? "" }:
|
||||||
let
|
let
|
||||||
msg = if inHydra
|
msg = if inHydra
|
||||||
then "Failed to evaluate ${getName attrs}: «${reason}»: ${errormsg}"
|
then "Failed to evaluate ${getNameWithVersion attrs}: «${reason}»: ${errormsg}"
|
||||||
else ''
|
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;
|
'' + (builtins.getAttr reason remediation) attrs;
|
||||||
|
|
||||||
|
@ -283,8 +283,8 @@ let
|
||||||
handleEvalWarning = { meta, attrs }: { reason , errormsg ? "" }:
|
handleEvalWarning = { meta, attrs }: { reason , errormsg ? "" }:
|
||||||
let
|
let
|
||||||
remediationMsg = (builtins.getAttr reason remediation) attrs;
|
remediationMsg = (builtins.getAttr reason remediation) attrs;
|
||||||
msg = if inHydra then "Warning while evaluating ${getName attrs}: «${reason}»: ${errormsg}"
|
msg = if inHydra then "Warning while evaluating ${getNameWithVersion attrs}: «${reason}»: ${errormsg}"
|
||||||
else "Package ${getName attrs} in ${pos_str meta} ${errormsg}, continuing anyway."
|
else "Package ${getNameWithVersion attrs} in ${pos_str meta} ${errormsg}, continuing anyway."
|
||||||
+ (optionalString (remediationMsg != "") "\n${remediationMsg}");
|
+ (optionalString (remediationMsg != "") "\n${remediationMsg}");
|
||||||
isEnabled = findFirst (x: x == reason) null showWarnings;
|
isEnabled = findFirst (x: x == reason) null showWarnings;
|
||||||
in if isEnabled != null then builtins.trace msg true else true;
|
in if isEnabled != null then builtins.trace msg true else true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue