aboutsummaryrefslogtreecommitdiff
path: root/tests/flakes-run.sh
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/flakes-run.sh
parent646af7325d93f98802b989f8a8e008a25f7a4788 (diff)
fix: ensure apps are apps and packages are packages
Diffstat (limited to 'tests/flakes-run.sh')
-rw-r--r--tests/flakes-run.sh29
1 files changed, 29 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
+