Change:
When running it fails due to an insecure package. To resolve this the output of recommends adding to the file (in my case for electron) This is incorrect as the correct line that should be must contain the package name and ver sion instead of just the package name (eg: instead of ) Steps to reproduce the behavior: while having an insecure package the instructions in the output The output must specify instead of in the sample code. This is the current (wrong) full output

Discussion:
# import <nixpkgs> { config = { showDerivationWarnings = [ "maintainerless" ]; }; } showWarnings = config.showDerivationWarnings; <del> getName = attrs: attrs.name or ("${attrs.pname or "«name-missing»"}-${attrs.version or "«version-missing»"}"); </del> <ins> getNameWithVersion = attrs: attrs.name or ("${attrs.pname or "«name-missing»"}-${attrs.version or "«version-missing»"}"); </ins> allowUnfree = config.allowUnfree || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1";

!allowUnfree && !allowUnfreePredicate attrs; <del> allowInsecureDefaultPredicate = x: builtins.elem (getName x) (config.permittedInsecurePackages or []); </del> <ins> allowInsecureDefaultPredicate = x: builtins.elem (getNameWithVersion x) (config.permittedInsecurePackages or []); </ins> allowInsecurePredicate = x: (config.allowInsecurePredicate or allowInsecureDefaultPredicate) x; hasAllowedInsecure = attrs:

$ export NIXPKGS_ALLOW_INSECURE=1 ${flakeNote} <del> b) for `nixos-rebuild` you can add ‘${lib.getName attrs}’ to </del> <ins> b) for `nixos-rebuild` you can add ‘${getNameWithVersion attrs}’ to </ins> `nixpkgs.config.permittedInsecurePackages` in the configuration.nix, like so: { nixpkgs.config.permittedInsecurePackages = [ <del> "${lib.getName attrs}" </del> <ins> "${getNameWithVersion attrs}" </ins> ]; } c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add <del> ‘${lib.getName attrs}’ to `permittedInsecurePackages` in </del> <ins> ‘${getNameWithVersion attrs}’ to `permittedInsecurePackages` in </ins> ~/.config/nixpkgs/config.nix, like so: { permittedInsecurePackages = [ <del> "${lib.getName attrs}" </del> <ins> "${getNameWithVersion attrs}" </ins> ]; }

actualOutputs = attrs.outputs or [ "out" ]; missingOutputs = builtins.filter (output: ! builtins.elem output actualOutputs) expectedOutputs; in '' <del> The package ${getName attrs} has set meta.outputsToInstall to: ${builtins.concatStringsSep ", " expectedOutputs} </del> <ins> The package ${getNameWithVersion attrs} has set meta.outputsToInstall to: ${builtins.concatStringsSep ", " expectedOutputs} </ins> <del> however ${getName attrs} only has the outputs: ${builtins.concatStringsSep ", " actualOutputs} </del> <ins> however ${getNameWithVersion attrs} only has the outputs: ${builtins.concatStringsSep ", " actualOutputs} </ins> and is missing the following ouputs:

handleEvalIssue = { meta, attrs }: { reason , errormsg ? "" }: let msg = if inHydra <del> then "Failed to evaluate ${getName attrs}: «${reason}»: ${errormsg}" </del> <ins> then "Failed to evaluate ${getNameWithVersion attrs}: «${reason}»: ${errormsg}" </ins> else '' <del> Package ‘${getName attrs}’ in ${pos_str meta} ${errormsg}, refusing to evaluate. </del> <ins> Package ‘${getNameWithVersion attrs}’ in ${pos_str meta} ${errormsg}, refusing to evaluate. </ins> '' + (builtins.getAttr reason remediation) attrs;

handleEvalWarning = { meta, attrs }: { reason , errormsg ? "" }: let remediationMsg = (builtins.getAttr reason remediation) attrs; <del> msg = if inHydra then "Warning while evaluating ${getName attrs}: «${reason}»: ${errormsg}" else "Package ${getName attrs} in ${pos_str meta} ${errormsg}, continuing anyway." </del> <ins> msg = if inHydra then "Warning while evaluating ${getNameWithVersion attrs}: «${reason}»: ${errormsg}" else "Package ${getNameWithVersion attrs} in ${pos_str meta} ${errormsg}, continuing anyway." </ins> + (optionalString (remediationMsg != "") "n${remediationMsg}"); isEnabled = findFirst (x: x == reason) null showWarnings; in if isEnabled != null then builtins.trace msg true else true;