-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Multiple imports of the same NixOS module not allowed with flake #340361
Comments
Where the relative import paths the same before? |
I made a test with a relative import path duplicated and it was working. |
I worked around this by creating a new module E that imports D from a flake. Then I modify B & C to import E instead of importing D directly. |
This comment was marked as spam.
This comment was marked as spam.
including them twice causes conflicting declaration errors maybe https://github.com/NixOS/nix/issues/7270(?)
This is quite annoying when you have several modules with the same module dependency, and have situations where you want to import two or more of them. |
@fricklerhandwerk the module system is defined in nixpkgs, so we should move zhe issue to there |
Feel free to do so. I do not have the permission to do it myself. |
Describe the bug
Importing multiple times a given NixOS module exposed by a flake is not allowed. Nix complains about options being already declared.
Steps To Reproduce
flake.nix
:flake.nix
:configuration.nix
:Expected behavior
It should be allowed to import multiple times a NixOS module that declare options. It already works today unless this module is exposed by a flake.
Importing multiple times into the same module is not very useful. What is useful is to import the same module (i.e.:
D
) into several modules (i.e.:B
,C
) which are themselves imported into one final module (i.e.:A
):nix-env --version
outputnix-env (Nix) 2.11.0
The text was updated successfully, but these errors were encountered: