-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
sharedModules: add pkgs
to module args
#1879
Conversation
fc99de1
to
2a08899
Compare
Looking at: home-manager/nixos/default.nix Lines 19 to 23 in 2a08899
I wonder whether we could rewrite it to |
That was my first attempt at a solution, unfortunately it didn't work. |
Sorry, I talked too soon :( |
@berbiche I thought that would work(earlier comment) too. Looking at the |
@Pacman99 I think paths are treated differently from functions unfortunately. If the sharedModule is a file then pkgs is available, otherwise it isn't and |
Yup, functions are eagerly checked whereas files and paths are not. |
Moreover, it looks like they need to be in the current implementation or infinite recursion is inevitable, so I now feel more confident that this is the proper and least invasive fix. |
No idea if this would work, but could a modules argument be added to modules/modules.nix and these modules can be passed to that. |
Since |
I think this is an issue of using the wrong type for shared modules. See my comment on the issue. |
`functionTo` type causes eager module eval before `_module.args` is passed. Relax submodule type constraint to fix nix-community#1878.
check for sharedModule type functionTo tries to evaluate functions too quickly and prevents sharedModules from accessing pkgs argument. Fixes nix-community#1879.
check for sharedModule type functionTo tries to evaluate functions too quickly and prevents sharedModules from accessing pkgs argument. Fixes nix-community#1879.
2a08899
to
b27dc1e
Compare
Duplicate of #1880 |
Fixes #1878.
Description
See the linked issue for context. Opting for a minimal solution.
Todo
useGlobalPackages
altogether and always opt for NixOS systemspkgs
.Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
.Test cases updated/added. See example.
Commit messages are formatted like