Using `home-manager.useGlobalPkgs` while using `nixpkgs.overlays` or `nixpkgs.config`

Hi, I just updated my flake and then rebuilt my system. During the evaluation I got:

evaluation warning: osi profile: You have set either `nixpkgs.config` or `nixpkgs.overlays` while using `home-manager.useGlobalPkgs`.
                    This will soon not be possible. Please remove all `nixpkgs` options when using `home-manager.useGlobalPkgs`.

As far as I understand, soon the global packages configured in NixOS modules must not be modified anymore to keep using these global packages for Home Manager. Though, thats exactly what I want. I want to add some custom packages from input flakes to the pkgs set and I want this set to be the same everywhere. Even in the Home Manager modules.

Do I understand that correctly? If so how to achieve the desired behaviour with the constraint home manager gives me here (soon)

You must only configure nixpkgs options in your NixOS config if you want useGlobalPkgs.

1 Like

Thanks @waffle8946. That solved it for me. What got me was that I had both nixpkgs options in the system config and the hm config which threw me off where to look.

Is there a way to see what’s triggering this message? I’m using home-manager system-wide in my flake and as far as I can tell, I don’t have any nixpkgs.config options and I don’t believe I’ve set any home-manager options outside of my home modules, but I do use overlays (that I’d like to keep using).

So where did you add the overlays?

I’m using snowfall-lib, so they’re added to nixpkgs from the ./overlays/ folder. The code in the library that handles that part is here.
Is it not possible to use overlays at all with useGlobalPkgs?

That’s an upstream bug, snowfalllib apparently sets the home-manager nixpkgs option in addition to the NixOS one.

That has never worked, so your configuration behavior won’t actually change. The overlays are presumably also applied to the NixOS nixpkgs in snowfalllib, otherwise you would have noticed something being off.

You should just be able to ignore the warning until upstream gets around to fixing it.

1 Like