I am not sure why, but values from _module.args cannot be accessed by modules in modules/nixos
Placing this module in modules/nixos
{ lib, config, ... }@options:
{
time.timeZone =
let
log-options = lib.trace (lib.attrNames options);
log-module-args = lib.trace (lib.attrNames config._module.args);
in
log-options log-module-args "UTC";
}
and then running nix eval .#nixosConfigurations.my-system.config.system.build.toplevel gives this result
# modules get these arguments
trace: [ "_class" "_prefix" "channel" "config" "format" "host" "inputs" "lib" "modulesPath" "namespace" "nixpkgsModulesPath" "options" "pkgs" "specialArgs" "system" "systems" "target" "virtual" ]
# but there are also these arguments in `_module.args`
trace: [ "baseModules" "extendModules" "extraModules" "inputs" "moduleType" "modules" "noUserModules" "pkgs" "utils" ]
As we can see, nothing except inputs and pkgs is passed to the modules
mre.zip
I am not sure why, but values from
_module.argscannot be accessed by modules inmodules/nixosPlacing this module in
modules/nixosand then running
nix eval .#nixosConfigurations.my-system.config.system.build.toplevelgives this resultAs we can see, nothing except
inputsandpkgsis passed to the modulesmre.zip