mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
Merge remote-tracking branch 'upstream/master' into indexed-store-path-outputs
This commit is contained in:
commit
41e755bee4
40 changed files with 286 additions and 159 deletions
|
@ -7,7 +7,9 @@ fi
|
|||
|
||||
clearStore
|
||||
|
||||
repo=$TEST_ROOT/hg
|
||||
# Intentionally not in a canonical form
|
||||
# See https://github.com/NixOS/nix/issues/6195
|
||||
repo=$TEST_ROOT/./hg
|
||||
|
||||
rm -rf $repo ${repo}-tmp $TEST_HOME/.cache/nix
|
||||
|
||||
|
@ -28,6 +30,12 @@ echo world > $repo/hello
|
|||
hg commit --cwd $repo -m 'Bla2'
|
||||
rev2=$(hg log --cwd $repo -r tip --template '{node}')
|
||||
|
||||
# Fetch an unclean branch.
|
||||
echo unclean > $repo/hello
|
||||
path=$(nix eval --impure --raw --expr "(builtins.fetchMercurial file://$repo).outPath")
|
||||
[[ $(cat $path/hello) = unclean ]]
|
||||
hg revert --cwd $repo --all
|
||||
|
||||
# Fetch the default branch.
|
||||
path=$(nix eval --impure --raw --expr "(builtins.fetchMercurial file://$repo).outPath")
|
||||
[[ $(cat $path/hello) = world ]]
|
||||
|
|
29
tests/flakes-run.sh
Normal file
29
tests/flakes-run.sh
Normal file
|
@ -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
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
nix_tests = \
|
||||
flakes.sh \
|
||||
flakes-run.sh \
|
||||
ca/gc.sh \
|
||||
gc.sh \
|
||||
remote-store.sh \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue