1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 15:32:43 +01:00
nix/tests/functional/readfile-context.nix
Robert Hensing 24c78e06cf Format .nix files
This does not include any automation for the release branch, but
is based on the configuration of https://github.com/NixOS/nix/pull/12349

    pre-commit run -a nixfmt-rfc-style
2025-01-24 20:37:38 +01:00

29 lines
691 B
Nix

with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix";
let
input = import ./simple.nix;
dependent = mkDerivation {
name = "dependent";
buildCommand = ''
mkdir -p $out
echo -n "$input1" > "$out/file1"
echo -n "$input2" > "$out/file2"
'';
input1 = "${input}/hello";
input2 = "hello";
};
readDependent = mkDerivation {
# Will evaluate correctly because file2 doesn't have any references,
# even though the `dependent` derivation does.
name = builtins.readFile (dependent + "/file2");
buildCommand = ''
echo "$input" > "$out"
'';
input = builtins.readFile (dependent + "/file1");
};
in
readDependent