Open datafoo opened 1 year ago
It should be allowed to import multiple times a NixOS module that declare options. It already works today unless this modules is exposed by a flake.
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.
ping
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
@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
Define a flake that expose a NixOS module which declare at least one option:
flake.nix
:Define another flake that uses the previous flake:
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