Having trouble allowing unfree in overlay

I’ve got unstable set up as an overlay on 23.05, which is great, because now I can use an unstable package anywhere I like without passing unstable all over the place. The only problem is that whenever I try to us an unfree package from unstable, I get the error, and I have no idea how to allow it. Here’s where I do the overlay:

https://git.sr.ht/~pkulak/nix/tree/main/item/configuration.nix#L58

Thanks for any help!

EDIT: I think I may be limiting myself with this setup here, but I don’t know how to not do this:

https://git.sr.ht/~pkulak/nix/tree/main/item/flake.nix#L23

nixpkgs-unstable.legacyPackages.${system} refers to an already evaluated instance of nixpkgs (pkgs = import nixpkgs { }). Whether to allow unfree/insecure/broken packages is the policy you define at import time: import nixpkgs { config.allowUnfree = true; }.

So in your flake you could use pkgs-unstable = import nixpkgs-unstable { config.allowUnfree = true; }. You may also find 1000 instances of nixpkgs relevant. Also note that this approach somewhat abuses the flake interface in that it doesn’t refer to any of its outputs but converts nixpkgs-unstable into a path instead

EDIT: Note that when you set nixpkgs.config.allowUnfree = true in ~pkulak/nix: configuration.nix - sourcehut git, you set the config for the pkgs that come in your modules’ arguments. OTOH, pkgs-unstable is an entirely independent instance of nixpkgs, taken from a different revision, and evaluated with different arguments

Thank you! I made the change and it works great:

https://git.sr.ht/~pkulak/nix/commit/aeb014a6ddbeef6655768f3ddc16cd65fb4ce52e

I take your point about referring to a path instead of an input… but maybe I’ll leave fixing that for another day. :smiley: