mirror of
https://github.com/NixOS/nix
synced 2025-07-10 08:53:55 +02:00
CA derivations that depend on other CA derivations
Co-authored-by: Théophane Hufschmitt <regnat@users.noreply.github.com>
This commit is contained in:
parent
e0b0e18905
commit
8eb73a8724
6 changed files with 189 additions and 28 deletions
|
@ -4,16 +4,40 @@ with import ./config.nix;
|
|||
# A simple content-addressed derivation.
|
||||
# The derivation can be arbitrarily modified by passing a different `seed`,
|
||||
# but the output will always be the same
|
||||
mkDerivation {
|
||||
name = "simple-content-addressed";
|
||||
buildCommand = ''
|
||||
set -x
|
||||
echo "Building a CA derivation"
|
||||
echo "The seed is ${toString seed}"
|
||||
mkdir -p $out
|
||||
echo "Hello World" > $out/hello
|
||||
'';
|
||||
__contentAddressed = true;
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
rec {
|
||||
root = mkDerivation {
|
||||
name = "simple-content-addressed";
|
||||
buildCommand = ''
|
||||
set -x
|
||||
echo "Building a CA derivation"
|
||||
echo "The seed is ${toString seed}"
|
||||
mkdir -p $out
|
||||
echo "Hello World" > $out/hello
|
||||
'';
|
||||
__contentAddressed = true;
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
};
|
||||
dependent = mkDerivation {
|
||||
name = "dependent";
|
||||
buildCommand = ''
|
||||
echo "building a dependent derivation"
|
||||
mkdir -p $out
|
||||
echo ${root}/hello > $out/dep
|
||||
'';
|
||||
__contentAddressed = true;
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
};
|
||||
transitivelyDependent = mkDerivation {
|
||||
name = "transitively-dependent";
|
||||
buildCommand = ''
|
||||
echo "building transitively-dependent"
|
||||
cat ${dependent}/dep
|
||||
echo ${dependent} > $out
|
||||
'';
|
||||
__contentAddressed = true;
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue