Describe the bug
When importing into a submodule, imports are not recognized unless the submodule is specified as a function. Also the error message is not helpful.
Normally the syntaxes for modules are interchangable. In particular:
{
imports = [ ./someFile.nix ];
}
is equivalent to
{...}: {
imports = [ ./someFile.nix ];
}
This does not work for submodules.
{
x.y = {...}: { imports = [ ./someFile.nix ]; };
}
should be equivalent to, but doesn't work when specified as
{
x.y.imports = [ ./someFile.nix ];
}
To Reproduce
This uses Arion as an example and to provide some context as to why one might want this:
$ git clone https://github.com/hercules-ci/arion; cd arion
$ git checkout for-nixpkgs-lib-imports-issue
$ cd examples/minimal
$ NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz ../../run-arion-via-nix cat --show-trace
[...]
The option `services.webserver.imports' defined in `/nix/store/sf3j91p62aznv9iy102sa0838qgjg61n-arion-0.1.0.0-data/share/ghc-8.6.4/x86_64-linux-ghc-8.6.4/arion-compose-0.1.0.0/nix/modules/composition/docker-compose.nix' does not exist.
Expected behavior
The simplification just works.
Metadata
Please run nix run nixpkgs.nix-info -c nix-info -m and paste the result.
NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz nix run nixpkgs.nix-info -c nix-info -m
warning: unknown setting 'sandbox-fallback'
- system: `"x86_64-linux"`
- host os: `Linux 5.2.13, NixOS, 19.09beta206.e6b068cd952 (Loris)`
- multi-user?: `yes`
- sandbox: `yes`
warning: unknown setting 'sandbox-fallback'
- version: `nix-env (Nix) 2.2.2`
warning: unknown setting 'sandbox-fallback'
- channels(user): `""`
warning: unknown setting 'sandbox-fallback'
- channels(root): `"nixos-19.09beta206.e6b068cd952, nixos-19.03-19.03.173506.2dfae8e22fd, stable-18.09.2574.a7e559a5504"`
warning: unknown setting 'sandbox-fallback'
- nixpkgs: `/nix/store/l9k8ycmrdn86a1lzgnx5c4ckld7k2l56-master.tar.gz`
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
Describe the bug
When importing into a submodule, imports are not recognized unless the submodule is specified as a function. Also the error message is not helpful.
Normally the syntaxes for modules are interchangable. In particular:
is equivalent to
This does not work for submodules.
should be equivalent to, but doesn't work when specified as
To Reproduce
This uses Arion as an example and to provide some context as to why one might want this:
Expected behavior
The simplification just works.
Metadata
Please run
nix run nixpkgs.nix-info -c nix-info -mand paste the result.Maintainer information: