aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTom Bereknyei <tomberek@gmail.com>2022-03-25 13:36:41 -0400
committerTom Bereknyei <tomberek@gmail.com>2022-04-14 23:57:52 -0400
commit9b41239d8fdcc3fe50febe718c15833ebc224354 (patch)
tree26faaae8e82c91d8790cd9e997863a349cf59c4c /tests
parent646af7325d93f98802b989f8a8e008a25f7a4788 (diff)
fix: ensure apps are apps and packages are packages
Diffstat (limited to 'tests')
-rw-r--r--tests/flakes-run.sh29
-rw-r--r--tests/local.mk1
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/flakes-run.sh b/tests/flakes-run.sh
new file mode 100644
index 000000000..c8035431c
--- /dev/null
+++ b/tests/flakes-run.sh
@@ -0,0 +1,29 @@
+source common.sh
+
+clearStore
+rm -rf $TEST_HOME/.cache $TEST_HOME/.config $TEST_HOME/.local
+cp ./shell-hello.nix ./config.nix $TEST_HOME
+cd $TEST_HOME
+
+cat <<EOF > flake.nix
+{
+ outputs = {self}: {
+ packages.$system.PkgAsPkg = (import ./shell-hello.nix).hello;
+ packages.$system.AppAsApp = self.packages.$system.AppAsApp;
+
+ apps.$system.PkgAsApp = self.packages.$system.PkgAsPkg;
+ apps.$system.AppAsApp = {
+ type = "app";
+ program = "\${(import ./shell-hello.nix).hello}/bin/hello";
+ };
+ };
+}
+EOF
+nix run --no-write-lock-file .#AppAsApp
+nix run --no-write-lock-file .#PkgAsPkg
+
+! nix run --no-write-lock-file .#PkgAsApp || fail "'nix run' shouldn’t accept an 'app' defined under 'packages'"
+! nix run --no-write-lock-file .#AppAsPkg || fail "elements of 'apps' should be of type 'app'"
+
+clearStore
+
diff --git a/tests/local.mk b/tests/local.mk
index 668b34500..51536188c 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -1,5 +1,6 @@
nix_tests = \
flakes.sh \
+ flakes-run.sh \
ca/gc.sh \
gc.sh \
remote-store.sh \