Don't check NixOS modules
NixOS modules can be paths. Rather than dig further down into the layer violation, don't check anything specific to NixOS modules.
This commit is contained in:
parent
d02c5a41da
commit
f1ee4ece80
|
@ -381,23 +381,6 @@ struct CmdFlakeCheck : FlakeCommand
|
|||
auto checkModule = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
||||
try {
|
||||
state->forceValue(v, pos);
|
||||
if (v.isLambda()) {
|
||||
if (!v.lambda.fun->hasFormals() || !v.lambda.fun->formals->ellipsis)
|
||||
throw Error("module must match an open attribute set ('{ config, ... }')");
|
||||
} else if (v.type() == nAttrs) {
|
||||
for (auto & attr : *v.attrs)
|
||||
try {
|
||||
state->forceValue(*attr.value, attr.pos);
|
||||
} catch (Error & e) {
|
||||
e.addTrace(
|
||||
state->positions[attr.pos],
|
||||
hintfmt("while evaluating the option '%s'", state->symbols[attr.name]));
|
||||
throw;
|
||||
}
|
||||
} else
|
||||
throw Error("module must be a function or an attribute set");
|
||||
// FIXME: if we have a 'nixpkgs' input, use it to
|
||||
// check the module.
|
||||
} catch (Error & e) {
|
||||
e.addTrace(resolve(pos), hintfmt("while checking the NixOS module '%s'", attrPath));
|
||||
reportError(e);
|
||||
|
|
|
@ -41,9 +41,9 @@ nix flake check $flakeDir
|
|||
cat > $flakeDir/flake.nix <<EOF
|
||||
{
|
||||
outputs = { self }: {
|
||||
nixosModules.foo = {
|
||||
nixosModules.foo = assert false; {
|
||||
a.b.c = 123;
|
||||
foo = assert false; true;
|
||||
foo = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -63,18 +63,6 @@ EOF
|
|||
|
||||
nix flake check $flakeDir
|
||||
|
||||
cat > $flakeDir/flake.nix <<EOF
|
||||
{
|
||||
outputs = { self }: {
|
||||
nixosModule = { config, pkgs }: {
|
||||
a.b.c = 123;
|
||||
};
|
||||
};
|
||||
}
|
||||
EOF
|
||||
|
||||
(! nix flake check $flakeDir)
|
||||
|
||||
cat > $flakeDir/flake.nix <<EOF
|
||||
{
|
||||
outputs = { self }: {
|
||||
|
|
Loading…
Reference in a new issue