-
-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modules/nixpkgs: initial pkgs
option; drop defaultPkgs
specialArg
#2301
modules/nixpkgs: initial pkgs
option; drop defaultPkgs
specialArg
#2301
Conversation
I'm starting to think attempting to pass a Looking at home-manager's implementation, they add the modules they import from nixos directly into the modules list passed to Nix-darwin simply copy the relevant modules into their repo, avoiding the need to import anything from nixos's modules. They also define a custom option If we want to move those modules into our repo tree, we should do that in a dedicated PR: #2302 |
c168602
to
0984a91
Compare
This comment was marked as resolved.
This comment was marked as resolved.
49fad07
to
7da114b
Compare
I've dropped the In combination with #2307 and #2302, we will now be able to remove I will amend whichever PR is open longer to remove those from our public API. |
pkgsPath
defaultPkgs
ebf6379
to
c0f2898
Compare
defaultPkgs
pkgs
option; drop defaultPkgs
specialArg
c0f2898
to
80ce7f5
Compare
80ce7f5
to
d6da345
Compare
c2416a9
to
b30d5b6
Compare
b30d5b6
to
52f2560
Compare
0a49f99
to
6abf055
Compare
6abf055
to
22b2f7b
Compare
@MattSturgeon I feel like this has come up numerous times, did we have an issue associated with this or was it always just discussions and matrix? Or was it just the one you created to track it? Sorry, I'm tired and scatter brained posting... lol |
The tracking issue is #1784. But yes, mismatched host/nixvim pkgs versions has come up in several issues and discussions. Those are all closed with the advice to use standalone mode for now, IIRC. This PR doesn't solve the issue,1 but it does provide users with an alternative tool to solve it themselves. Footnotes
|
e3cbb96
to
b856d8e
Compare
Make `pkgs` available to files submodules by passing _all_ module args through. We already did this for `specialArgs`.
This minimal implementation allows `nixpkgs.pkgs` to be defined, but does not implement evaluating an instance from a pkgsPath when _not_ defined. The `defaultPkgs` specialArg is dropped in favour of `nixpkgs.pkgs` being defined. If it's not defined, an assertion is thrown. In the future, a nixpkgs source path can be supplied, defaulting to the flake's `inputs.nixpkgs`. Along with other `nixpkgs.*` options, this will allow a `pkgs` instance to be evaluated within the module eval.
b856d8e
to
5020e58
Compare
@Mergifyio queue |
🛑 The pull request has been merged manuallyThe pull request has been merged manually at 5020e58 |
Subset of #2022, working towards #1784
Note for end-users
This PR allows you to configure a
pkgs
for nixvim's submodule that is different to the one used in your "host" configuration. In this context, a "host" configuration could be home-manager, nixos, or nix-darwin.For example, this means you don't neccessarily have to use nixvim's standalone build in order to use nixvim's main branch together with a "stable" nixpkgs.
Assuming you have
inputs.nixpkgs-unstable
in your flake and you passinputs
into your module config somehow (e.g. viaspecialArgs
) you can do:You could use a let-in block to make the above more readable:
Note
In the future we plan to simplify this further, by using the nixpkgs from our flake inputs by default.
This would mean you wouldn't have to do anything in order to use nixvim's main branch with a stable "host" configuration.
However, this would be a breaking change for anyone relying on a specific pkgs instance (configured in their host modules) also being used by their nixvim config.
Overview
I've implemented only the
nixpkgs.pkgs
option, omitting othernixpkgs.*
options that would allow instantiating a nixpkgs instance internally for now for the sake of simplicity.This is enough to allow end-users to set
programs.nixvim.nixpkgs.pkgs
to something other than their host module'spkgs
, e.g. allowing nixvim unstable to be used on nixos stable without resorting to a standalone nixvim.nixpkgs.pkgs
option is used to allow an "externally constructed" nixpkgs instance to be used as the pkgs arg.(implemented)
nixpkgs.*
is used to "internally" construct a nixpkgs instance, by evaluating a nixpkgs source path with the configured config, system, overlays, etc.(unimplemented)
Internally, this also allows the initial migration of
defaultPkgs
->pkgsPath
, however I've ran into a couple roadblocks:pkgsPath
to be a specialArg because we import using it. Maybe this is a bad idea and we should just copy the upstream modules?pkgsPath
is a "string with context", then themeta
module runs into errors. This means we can't just setpkgsPath = inputs.nixvim
because that has context.