From ec6c59494497d5679ed1d1d4086abacd89de8ef4 Mon Sep 17 00:00:00 2001 From: Dan Callahan Date: Wed, 10 Apr 2024 16:15:24 +0100 Subject: [PATCH] stdenv/check-meta: Fix error message for disallowed unfree packages Nixpkgs tries to print a helpful message when it blocks unfree packages, but the suggestion is subtly broken. The predicate only matches on the package's name, but the suggestion includes the full name-version pair. Fixed by formatting the message with the same function as the predicate. This issue arises because check-meta defines its own local getName with semantics divergent from lib.getName. The former includes the version, the latter does not. Example Before: Alternatively you can configure a predicate to allow specific packages: { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "obsidian-1.5.12" ]; } Example After: Alternatively you can configure a predicate to allow specific packages: { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "obsidian" ]; } Fixes #303116 --- pkgs/stdenv/generic/check-meta.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index bcb2ca249ddf..a61f3e1ae4d0 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -189,7 +189,7 @@ let Alternatively you can configure a predicate to allow specific packages: { nixpkgs.config.${predicateConfigAttr} = pkg: builtins.elem (lib.getName pkg) [ - "${getName attrs}" + "${lib.getName attrs}" ]; } '';