mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 16:23:02 +00:00
f1ee4ece80
NixOS modules can be paths. Rather than dig further down into the layer violation, don't check anything specific to NixOS modules.
78 lines
1.2 KiB
Bash
78 lines
1.2 KiB
Bash
source common.sh
|
|
|
|
flakeDir=$TEST_ROOT/flake3
|
|
mkdir -p $flakeDir
|
|
|
|
cat > $flakeDir/flake.nix <<EOF
|
|
{
|
|
outputs = { self }: {
|
|
overlay = final: prev: {
|
|
};
|
|
};
|
|
}
|
|
EOF
|
|
|
|
nix flake check $flakeDir
|
|
|
|
cat > $flakeDir/flake.nix <<EOF
|
|
{
|
|
outputs = { self }: {
|
|
overlay = finalll: prev: {
|
|
};
|
|
};
|
|
}
|
|
EOF
|
|
|
|
(! nix flake check $flakeDir)
|
|
|
|
cat > $flakeDir/flake.nix <<EOF
|
|
{
|
|
outputs = { self }: {
|
|
nixosModules.foo = {
|
|
a.b.c = 123;
|
|
foo = true;
|
|
};
|
|
};
|
|
}
|
|
EOF
|
|
|
|
nix flake check $flakeDir
|
|
|
|
cat > $flakeDir/flake.nix <<EOF
|
|
{
|
|
outputs = { self }: {
|
|
nixosModules.foo = assert false; {
|
|
a.b.c = 123;
|
|
foo = true;
|
|
};
|
|
};
|
|
}
|
|
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 }: {
|
|
packages.system-1.default = "foo";
|
|
packages.system-2.default = "bar";
|
|
};
|
|
}
|
|
EOF
|
|
|
|
checkRes=$(nix flake check --keep-going $flakeDir 2>&1 && fail "nix flake check should have failed" || true)
|
|
echo "$checkRes" | grep -q "packages.system-1.default"
|
|
echo "$checkRes" | grep -q "packages.system-2.default"
|