diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-04-19 13:41:24 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-04-19 13:41:24 +0200 |
commit | b529a4181444e0c52234b3900b89dc7994d5268f (patch) | |
tree | b97ff44efde20da9d74a04569fbaf0808762d1b8 /tests | |
parent | 1b43d646484a1d18d12fcc8912eda4a01d5d3eb6 (diff) | |
parent | 9b41239d8fdcc3fe50febe718c15833ebc224354 (diff) |
Merge branch 'make-flake-show-more-lenient-on-apps' of https://github.com/flox/nix
Diffstat (limited to 'tests')
-rw-r--r-- | tests/flakes-run.sh | 29 | ||||
-rw-r--r-- | tests/local.mk | 1 |
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 \ |