nixos/misc/nixpkgs add setting nixpkgs.config.allowUnfreePackages = ["list" "of" "packages"]#396595
Conversation
nixos/modules/misc/nixpkgs.nix
Outdated
There was a problem hiding this comment.
To make this more scalable:
| ) (pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowUnfreePackages); | |
| ) (pkg: allowUnfreePackagesAsSet?${lib.getName pkg}); |
And then in a let binding outside of the pkg: function, something like
lib.genAttrs (_name: null) config.nixpkgs.allowUnfreePackagesThere was a problem hiding this comment.
Is there a way to get a feel for the performance tradeoffs of these kind of changes? In procedural languages, it is quite often faster to use lists for these kind of tests - for small lists of around 8 or less items, than produce a hash and add everything to it.
This of course hinges on the assumption that this is only called for the actual unfree packages that are in my closure, which should be usually be exactly as many as are in this list.
|
@roberth Thanks for the input, sorry to say that it will likely take me some time to react. In the meantime: The eval fails with an error I'm not seeing locally: I would appreciate some guidance on how to reproduce / avoid this. |
Looking at generic/check-meta.nix#126 it looks like the safest way to solve this would be to enhance that code to change the fallback function to look into The whole thing is constructed in this strange way, which makes me think that there may be a rationale behind this? Perhaps something like that one can share the I have to admit that I don't really understand why this is built like this. :/ |
There's 2 ways to use Nixpkgs: standalone, where NixOS configures Nixpkgs, or you can use NixOS with an already configured Nixpkgs. Yours seems to be of the latter kind, based on the error message. You could either change it to ignore the |
|
@roberth Not quite sure I get you, that error is from a check in a GitHub runner - not from my system. From reading the code it seems likely (though I didn't find anything definitive) that what I am doing in the code, that is setting something in nixpkgs.config from inside nixpkgs is unwanted? I don't quite grok the message and the code that generates it so the intent of that error message is not clear to me. |
33873b2 to
571ef97
Compare
|
@roberth I think I found a better way to integrate this functionality. This involves a custom merge function on the To me, there should probably be some sort of assertion to prevent you defining both a predicate and the list of package names, but at least it works, and doesn't complain in the nixpkgs checks, so this is hopefully a good start. |
571ef97 to
76dca3e
Compare
afh
left a comment
There was a problem hiding this comment.
👍 on the approach, please find minor comments
|
Some more points for discussion / input that I gathered from reading the code, but am not sure I get correctly as I haven't found any documentation on this:
I guess there is more, but I would really like some input on these questions to know how to develop this further. For this I would like to ping @roberth and perhaps @emilazy or some of the contributors who worked on this previously like @Stunkymonkey or @Mic92 or @reckenrode (at least if I interpret the history of these files correctly. Sorry if I don't). |
76dca3e to
5ffc7a4
Compare
As we don't have "NixOS/nixpkgs#396595" this is the best we can do currently.
c7c7599 to
308b135
Compare
|
@roberth I would also appreciate another review from you. |
f30bf12 to
01a69f0
Compare
|
This is working for me. 🎉 But the pull request title and commit descriptions still refer to |
|
@Majiir am I missing something? What would you have expected the pull request title to be? |
|
The new option is |
…["list" "of "packages"] Inspired by NixOS#197325 this adds a new option nixpkgs.allowUnfreePackages, which merges additively and can thus be defined in multiple modules close to where the unfree package is installed. I would have liked ot name this option nixpkgs.config.allowUnfreePackages, to define it closer to where the allowUnfree and allowUnfreePredicate are defined, but I didn't see how this could be achived. I would welcome some guidance on how to do this.
01a69f0 to
b9cccbb
Compare
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
Thank you for your patience in waiting for the review and merge. There are two followup tasks here:
|
|
Regarding of sharing the option type between nixos and pkgs made this pr for that #489889 |
Inspired by #197325 this adds a new option nixpkgs.allowUnfreePackages, which merges additively and can thus be defined in multiple modules close to where the unfree package is installed.
I would have liked ot name this option
nixpkgs.config.allowUnfreePackages, to define it closer to where theallowUnfreeandallowUnfreePredicateoptions are defined, but I didn't see how this could be achived, given thatnixpkgs.configis an attribute set or function instead of a module. I would welcome some guidance on how to do this.I would also have liked to have an assertion that this setting should not be defined when
nixpkgs.config.allowUnfreePredicate ornixpkgs.config.allowUnfree` is set, but I don't yet know how to do that. (And I would like to learn).Closes #197325
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.