Add a default.nix to the folder an there import your modules.
configuration.nix
{
imports = [ ./components ./programs ./users ];
}
./components/default.nix
{
imports = [
./base-config.nix
./graphical.nix
./networking.nix
./sound.nix
./bluetooth.nix
./printing.nix
];
}
with
keyword exposes an attr, ie:
let
programsPaths = {
core = ./programs/core.nix;
cad = ./programs/cad.nix;
};
programs = with programsPaths; [ core cad ];
in
{
imports = programs ++ compontens ++ users;
};
Would be easier just add paths without with
You could use let after equals and concat vars
let
components = let p = ../components/general; in [
(p + "/base-config.nix")
(p + "/graphical.nix")
];
in
{
imports = components ++ programs ++users;
}
I would prefer default.nix version
In your example has ...
in nix parent dir is ../
, current dir is ./.
There is also Haumea. to convert your dir structure in options. But to your case would be too complex.