The pkgs.json in addition to nix install seemed quite viable, so I made a proof-of-concept this evening: Pocnix: a proof-of-concept Nix CLI
1 Like
It needs to be pkg.pname instead of pkg.name. At least, on nixos-19.09.
Following the issue Wrong documentation for non-free packages · Issue #67830 · NixOS/nixpkgs · GitHub.
1 Like
Hah.
- The right solution appears to be checking for both
pnameandnameas showed here. - While parsing
pkg.pnameworks, it is redundant.Notice that you shouldn’t have to apply
builtins.parseDrvNametopkg.pname, as the latter already is the package name without the version suffix.
Example:
nixpkgs.config.allowUnfreePredicate =
(pkg: builtins.elem (pkg.pname or (builtins.parseDrvName pkg.name).name)
[ "unrar" ]);
1 Like