aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/linux-sandbox-cert-test.nix
blob: fe36baf6bca608a2e3af016dade82b5296df4682 (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
{ mode }:

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;
    '';
  } // {
    fixed-output = { outputHash = "sha256:0000000000000000000000000000000000000000000000000000000000000000"; };
    normal = { };
  }.${mode}
)