[Feature Request] nixpkgs.pkgs
feature request
### Module Name
nixpkgs
### Requested Feature
First, sorry ahead of time if I simply missed something along my research or thinking process 😓
A large enough repository with multiple NixOS/nix-darwin configurations with possibly numerous nested home-manager evaluations can benefit from those home-manager evaluations inheriting a `pkgs` instance instead of each instantiating one themselves. The difference is multiple seconds and compounding, from my experimentation.
As far as I can tell, in the context of `nixos` and `nix-darwin` this can be achieved by setting `home-manager.useGlobalPkgs = true;`
So far, so good. Optimization achieved 💪
But... a little bit more background, if I may. Nixvim has a stylix integration (count of ecosystem projects involved just rose to 5 or more, depending how you count 😆). Now, bear with me. stylix is not a configuration class; it provides modules for nixos, home-manager and nixvim (and more). But, strangely, the nixvim modules are second-class and are only available in the context of a nixos or home-manager evaluations 🤷 ([discussion](https://github.com/nix-community/stylix/discussions/2382)).
Now, I personally do is instantiate a NixVim within a global pkgs instance in my infra repo via an overlay. Of course, due to the above mentioned stylix limitation, that nixvim is not styled.
I think stylix supporting nixvim as "a platform" would obviate this particular need I'm feeling, but that's not currently the case and perhaps this feature I'm about to suggest can be useful for other cases, so I will continue.
If I could provide home-manager with an overlay that overrides the `prev.nixvim` and applies stylix to it, then I'd be golden: I'd have both a global `nix run .#nixvim` for fast iteration and a styled nixvim within my user home. I think I would like that. And home-manager does provide a `nixpkgs.overlays` option, but—and here's the problem—`nixpkgs.overlays` cannot be used with `home-manager.useGlobalPkgs` (eval error). Of course, I can work around this, with flake-parts' `withSystem` but I prefer overlays, because they are a Nixpkgs feature instead of a flake-parts feature and they're more powerful and I'm already using them so why use two different mechanisms to achieve similar things.
So, I suggest that home-manager's `nixpkgs.overlays` do allow extending a provided `pkgs` instance. This can either apply to an instance obtained via `home-manager.useGlobalPkgs` or to a new `nixpkgs.pkgs` option. Nixvim has that exactly ([docs](https://nix-community.github.io/nixvim/NeovimOptions/nixpkgs/index.html#nixpkgsoverlays))
I know this is long. Thank you for reading. I hope I managed to come across coherently.
### Current Limitations
_No response_
### Additional Context
https://github.com/mightyiam/infra, if it helps
0 条评论