forked from lix-project/lix
8eb73a8724
Co-authored-by: Théophane Hufschmitt <regnat@users.noreply.github.com>
44 lines
1.1 KiB
Nix
44 lines
1.1 KiB
Nix
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 {
|
|
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";
|
|
};
|
|
}
|