Both of them are imported in configuration.nix
However, seems nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) []; cannot be duplicate in multiple file like environment.systemPackages = with pkgs; [], I have to put all of them in one place to make it work.
How can I separate them into multiple .nix file? Thanks!
There’s no better way than to implement this downstream via a polyfill like that currently.
@piegames asked about changing the option a while ago, aiming to simplify things a bit, there’s some fear of breaking backwards-compatibility by introducing an option that only matches package names (though this could be avoided by making any new options incompatible). Not much has happened on the topic since.
I think that the best way forward from here is to continue implementing RFC 127, then figure out how to migrate the individual options. Unfortunately nobody is currently working on that at the moment
Since the underlying option is identical this works in Home Manager as well. Indeed I reuse the same code as both modules.nixpkgs-issue-55674 and hmModules.nixpkgs-issue-55674.