diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-07-13 14:09:35 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-07-13 15:06:54 +0200 |
commit | 420957e149256677046b2433135f53ab0dadab3c (patch) | |
tree | f215fce3c54c33f43a3df9e9d08d1dbd58cb43e3 /tests/flakes/run.sh | |
parent | e1153069bd0e3320227c997c32e657f7e652a212 (diff) |
Move flakes tests to a subdirectory
Diffstat (limited to 'tests/flakes/run.sh')
-rw-r--r-- | tests/flakes/run.sh | 29 |
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..9fa51d1c7 --- /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 + |