Admins will be upgrading ORNL GitLab Servers on Saturday, 16 May 2026, from 7 AM until 11 AM EST. Repositories will experience intermittent outages during this time.
"Could not load a value as a module, because it is of type ${lib.strings.escapeNixStringm._type}"
+lib.optionalString(fallbackFile!=unknownModule)", in file ${toStringfallbackFile}."
+lib.optionalString(m._type=="configuration")" If you do intend to import this configuration, please only import the modules that make up the configuration. You may have to create a `let` binding, file or attribute to give yourself access to the relevant modules.\nWhile loading a configuration into the module system is a very sensible idea, it can not be done cleanly in practice."
+optionalString(fallbackFile!=unknownModule)", in file ${toStringfallbackFile}."
+optionalString(m._type=="configuration")" If you do intend to import this configuration, please only import the modules that make up the configuration. You may have to create a `let` binding, file or attribute to give yourself access to the relevant modules.\nWhile loading a configuration into the module system is a very sensible idea, it can not be done cleanly in practice."
# Extended explanation: That's because a finalized configuration is more than just a set of modules. For instance, it has its own `specialArgs` that, by the nature of `specialArgs` can't be loaded through `imports` or the the `modules` argument. So instead, we have to ask you to extract the relevant modules and use those instead. This way, we keep the module system comparatively simple, and hopefully avoid a bad surprise down the line.
)
elseifisListmthen
@@ -415,7 +427,7 @@ let
moduleKey=file:m:
ifisStringm
then
ifbuiltins.substring01m=="/"
ifsubstring01m=="/"
thenm
elsetoStringmodulesPath+"/"+m
@@ -433,11 +445,11 @@ let
elseifisAttrsm
thenthrow"Module `${file}` contains a disabledModules item that is an attribute set, presumably a module, that does not have a `key` attribute. This means that the module system doesn't have any means to identify the module that should be disabled. Make sure that you've put the correct value in disabledModules: a string path relative to modulesPath, a path value, or an attribute set with a `key` attribute."
elsethrow"Each disabledModules item must be a path, string, or a attribute set with a key attribute, or a value supported by toString. However, one of the disabledModules items in `${toStringfile}` is none of that, but is of type ${builtins.typeOfm}.";
elsethrow"Each disabledModules item must be a path, string, or a attribute set with a key attribute, or a value supported by toString. However, one of the disabledModules items in `${toStringfile}` is none of that, but is of type ${typeOfm}.";
# The root of any module definition must be an attrset.
checkedConfigs=
assert
lib.all
all
(c:
# TODO: I have my doubts that this error would occur when option definitions are not matched.
# The implementation of this check used to be tied to a superficially similar check for
# options, so maybe that's why this is here.
isAttrsc.config||throw''
In module `${c.file}', you're trying to define a value of type `${builtins.typeOfc.config}'
In module `${c.file}', you're trying to define a value of type `${typeOfc.config}'
rather than an attribute set for the option
`${builtins.concatStringsSep"."prefix}'!
`${concatStringsSep"."prefix}'!
This usually happens if `${builtins.concatStringsSep"."prefix}' has option
This usually happens if `${concatStringsSep"."prefix}' has option
definitions inside that are not matched. Please check how to properly define
this option by e.g. referring to `man 5 configuration.nix'!
''
@@ -667,7 +679,7 @@ let
let
nonOptions=filter(m:!isOptionm.options)decls;
in
throw"The option `${showOptionloc}' in module `${(lib.headoptionDecls)._file}' would be a parent of the following options, but its type `${(lib.headoptionDecls).options.type.descriptionor"<no description>"}' does not support nested options.\n${
throw"The option `${showOptionloc}' in module `${(headoptionDecls)._file}' would be a parent of the following options, but its type `${(headoptionDecls).options.type.descriptionor"<no description>"}' does not support nested options.\n${
showRawDeclslocnonOptions
}"
else
@@ -806,7 +818,7 @@ let
"The type `types.${opt.type.name}' of option `${showOptionloc}' defined in ${showFilesopt.declarations} is deprecated. ${opt.type.deprecationMessage}";
inwarnDeprecationopt//
{value=builtins.addErrorContext"while evaluating the option `${showOptionloc}':"value;
{value=addErrorContext"while evaluating the option `${showOptionloc}':"value;
inherit(res.defsFinal')highestPrio;
definitions=map(def:def.value)res.defsFinal;
files=map(def:def.file)res.defsFinal;
@@ -822,7 +834,7 @@ let
let
# Process mkMerge and mkIf properties.
defs'=concatMap(m:
map(value:{inherit(m)file;inheritvalue;})(builtins.addErrorContext"while evaluating definitions from `${m.file}':"(dischargePropertiesm.value))
map(value:{inherit(m)file;inheritvalue;})(addErrorContext"while evaluating definitions from `${m.file}':"(dischargePropertiesm.value))
mkVMOverride=mkOverride10;# used by ‘nixos-rebuild build-vm’
defaultPriority=lib.warnIf(lib.isInOldestRelease2305)"lib.modules.defaultPriority is deprecated, please use lib.modules.defaultOverridePriority instead."defaultOverridePriority;
defaultPriority=warnIf(isInOldestRelease2305)"lib.modules.defaultPriority is deprecated, please use lib.modules.defaultOverridePriority instead."defaultOverridePriority;
mkFixStrictness=lib.warn"lib.mkFixStrictness has no effect and will be removed. It returns its argument unmodified, so you can just remove any calls."id;
mkFixStrictness=warn"lib.mkFixStrictness has no effect and will be removed. It returns its argument unmodified, so you can just remove any calls."id;
mkOrder=priority:content:
{_type="order";
@@ -1121,7 +1133,7 @@ let
inheritfromto;
visible=false;
warn=true;
use=builtins.trace"Obsolete option `${showOptionfrom}' is used. It was renamed to `${showOptionto}'.";
use=trace"Obsolete option `${showOptionfrom}' is used. It was renamed to `${showOptionto}'.";
};
mkRenamedOptionModuleWith={
@@ -1139,8 +1151,8 @@ let
}:doRename{
inheritfromto;
visible=false;
warn=lib.isInOldestReleasesinceRelease;
use=lib.warnIf(lib.isInOldestReleasesinceRelease)
warn=isInOldestReleasesinceRelease;
use=warnIf(isInOldestReleasesinceRelease)
"Obsolete option `${showOptionfrom}' is used. It was renamed to `${showOptionto}'.";
};
@@ -1372,8 +1384,8 @@ let
config=lib.importTOMLfile;
};
private=lib.mapAttrs
(k:lib.warn"External use of `lib.modules.${k}` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/.")
private=mapAttrs
(k:warn"External use of `lib.modules.${k}` is deprecated. If your use case isn't covered by non-deprecated functions, we'd like to know more and perhaps support your use case well, instead of providing access to these low level functions. In this case please open an issue in https://github.com/nixos/nixpkgs/issues/.")
# We currently throw this error already in `config`, but throwing in `config.wrong1` would be acceptable.
checkConfigError 'It seems as if you.re trying to declare an option by placing it into .config. rather than .options.' config.wrong1 ./error-mkOption-in-config.nix