aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-09-10 16:03:03 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-09-10 16:03:03 +0200
commitf3f854dac15d5e5318cd0398fd50a8d8db4f6fd0 (patch)
treee1aa3268393500f5c094eff92f8d79915c44b396
parent4b9dee6bcca48bd60f341cb07273a33e632bafc2 (diff)
nix flake check: Add some tests
-rw-r--r--tests/flakes.sh85
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/flakes.sh b/tests/flakes.sh
index 8594a4c55..7f41d5d7e 100644
--- a/tests/flakes.sh
+++ b/tests/flakes.sh
@@ -344,3 +344,88 @@ nix flake --flake-registry $registry check $flake3Dir
rm -rf $TEST_ROOT/flake1-v2
nix flake clone --flake-registry $registry flake1 $TEST_ROOT/flake1-v2
+
+# More 'nix flake check' tests.
+cat > $flake3Dir/flake.nix <<EOF
+{
+ edition = 201909;
+
+ outputs = { flake1, self }: {
+ overlay = final: prev: {
+ };
+ };
+}
+EOF
+
+nix flake check --flake-registry $registry $flake3Dir
+
+cat > $flake3Dir/flake.nix <<EOF
+{
+ edition = 201909;
+
+ outputs = { flake1, self }: {
+ overlay = finalll: prev: {
+ };
+ };
+}
+EOF
+
+(! nix flake check --flake-registry $registry $flake3Dir)
+
+cat > $flake3Dir/flake.nix <<EOF
+{
+ edition = 201909;
+
+ outputs = { flake1, self }: {
+ nixosModules.foo = {
+ a.b.c = 123;
+ foo = true;
+ };
+ };
+}
+EOF
+
+nix flake check --flake-registry $registry $flake3Dir
+
+cat > $flake3Dir/flake.nix <<EOF
+{
+ edition = 201909;
+
+ outputs = { flake1, self }: {
+ nixosModules.foo = {
+ a.b.c = 123;
+ foo = assert false; true;
+ };
+ };
+}
+EOF
+
+(! nix flake check --flake-registry $registry $flake3Dir)
+
+cat > $flake3Dir/flake.nix <<EOF
+{
+ edition = 201909;
+
+ outputs = { flake1, self }: {
+ nixosModule = { config, pkgs, ... }: {
+ a.b.c = 123;
+ };
+ };
+}
+EOF
+
+nix flake check --flake-registry $registry $flake3Dir
+
+cat > $flake3Dir/flake.nix <<EOF
+{
+ edition = 201909;
+
+ outputs = { flake1, self }: {
+ nixosModule = { config, pkgs }: {
+ a.b.c = 123;
+ };
+ };
+}
+EOF
+
+(! nix flake check --flake-registry $registry $flake3Dir)