mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
Merge remote-tracking branch 'upstream/master' into remove-storetype-delegate-regStore
This commit is contained in:
commit
f60b380a7f
62 changed files with 1694 additions and 857 deletions
32
tests/content-addressed.nix
Normal file
32
tests/content-addressed.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
with import ./config.nix;
|
||||
|
||||
{ seed ? 0 }:
|
||||
# A simple content-addressed derivation.
|
||||
# The derivation can be arbitrarily modified by passing a different `seed`,
|
||||
# but the output will always be the same
|
||||
rec {
|
||||
rootLegacy = mkDerivation {
|
||||
name = "simple-input-addressed";
|
||||
buildCommand = ''
|
||||
set -x
|
||||
echo "Building a legacy derivation"
|
||||
mkdir -p $out
|
||||
echo "Hello World" > $out/hello
|
||||
'';
|
||||
};
|
||||
rootCA = mkDerivation {
|
||||
name = "dependent";
|
||||
outputs = [ "out" "dev" ];
|
||||
buildCommand = ''
|
||||
echo "building a CA derivation"
|
||||
echo "The seed is ${toString seed}"
|
||||
mkdir -p $out
|
||||
echo ${rootLegacy}/hello > $out/dep
|
||||
# test symlink at root
|
||||
ln -s $out $dev
|
||||
'';
|
||||
__contentAddressed = true;
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
};
|
||||
}
|
17
tests/content-addressed.sh
Normal file
17
tests/content-addressed.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source common.sh
|
||||
|
||||
clearStore
|
||||
clearCache
|
||||
|
||||
export REMOTE_STORE=file://$cacheDir
|
||||
|
||||
drv=$(nix-instantiate --experimental-features ca-derivations ./content-addressed.nix -A rootCA --arg seed 1)
|
||||
nix --experimental-features 'nix-command ca-derivations' show-derivation --derivation "$drv" --arg seed 1
|
||||
|
||||
commonArgs=("--experimental-features" "ca-derivations" "./content-addressed.nix" "-A" "rootCA" "--no-out-link")
|
||||
out1=$(nix-build "${commonArgs[@]}" ./content-addressed.nix --arg seed 1)
|
||||
out2=$(nix-build "${commonArgs[@]}" ./content-addressed.nix --arg seed 2)
|
||||
|
||||
test $out1 == $out2
|
8
tests/describe-stores.sh
Normal file
8
tests/describe-stores.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
source common.sh
|
||||
|
||||
# Query an arbitrary value in `nix describe-stores --json`'s output just to
|
||||
# check that it has the right structure
|
||||
[[ $(nix --experimental-features 'nix-command flakes' describe-stores --json | jq '.["SSH Store"]["compress"]["defaultValue"]') == false ]]
|
||||
|
||||
# Ensure that the output of `nix describe-stores` isn't empty
|
||||
[[ -n $(nix --experimental-features 'nix-command flakes' describe-stores) ]]
|
|
@ -33,7 +33,9 @@ nix_tests = \
|
|||
post-hook.sh \
|
||||
function-trace.sh \
|
||||
recursive.sh \
|
||||
flakes.sh
|
||||
describe-stores.sh \
|
||||
flakes.sh \
|
||||
content-addressed.sh
|
||||
# parallel.sh
|
||||
# build-remote-content-addressed-fixed.sh \
|
||||
|
||||
|
|
|
@ -2,6 +2,21 @@ with import ./config.nix;
|
|||
|
||||
rec {
|
||||
|
||||
# Want to ensure that "out" doesn't get a suffix on it's path.
|
||||
nameCheck = mkDerivation {
|
||||
name = "multiple-outputs-a";
|
||||
outputs = [ "out" "dev" ];
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
mkdir $first $second
|
||||
test -z $all
|
||||
echo "first" > $first/file
|
||||
echo "second" > $second/file
|
||||
ln -s $first $second/link
|
||||
'';
|
||||
helloString = "Hello, world!";
|
||||
};
|
||||
|
||||
a = mkDerivation {
|
||||
name = "multiple-outputs-a";
|
||||
outputs = [ "first" "second" ];
|
||||
|
|
|
@ -4,6 +4,12 @@ clearStore
|
|||
|
||||
rm -f $TEST_ROOT/result*
|
||||
|
||||
# Test whether the output names match our expectations
|
||||
outPath=$(nix-instantiate multiple-outputs.nix --eval -A nameCheck.out.outPath)
|
||||
[ "$(echo "$outPath" | sed -E 's_^".*/[^-/]*-([^/]*)"$_\1_')" = "multiple-outputs-a" ]
|
||||
outPath=$(nix-instantiate multiple-outputs.nix --eval -A nameCheck.dev.outPath)
|
||||
[ "$(echo "$outPath" | sed -E 's_^".*/[^-/]*-([^/]*)"$_\1_')" = "multiple-outputs-a-dev" ]
|
||||
|
||||
# Test whether read-only evaluation works when referring to the
|
||||
# ‘drvPath’ attribute.
|
||||
echo "evaluating c..."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue