aboutsummaryrefslogtreecommitdiff
path: root/tests/linux-sandbox-cert-test.nix
blob: 2b86dad2e1dc2959d82b24172e5a643f09941ca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ fixed-output }:

with import ./config.nix;

mkDerivation ({
  name = "ssl-export";
  buildCommand = ''
    # Add some indirection, otherwise grepping into the debug output finds the string.
    report () { echo CERT_$1_IN_SANDBOX; }

    if [ -f /etc/ssl/certs/ca-certificates.crt ]; then
      content=$(</etc/ssl/certs/ca-certificates.crt)
      if [ "$content" == CERT_CONTENT ]; then
        report present
      fi
    else
      report missing
    fi

    # Always fail, because we do not want to bother with fixed-output
    # derivations being cached, and do not want to compute the right hash.
    false;
  '';
} // (
  if fixed-output == "fixed-output"
  then { outputHash = "sha256:0000000000000000000000000000000000000000000000000000000000000000"; }
  else { }
))