summaryrefslogtreecommitdiffstats
path: root/pkgs/test/build-environment-info/default.nix
blob: dce91edbf4d1b4a2a25dc24193b6556c938b5b8f (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
30
31
32
33
34
35
36
37
38
39
{
  lib,
  stdenv,
  runCommand,
  getent,
  xcbuild,
}:

# Prints information about the state of the build environment for
# assistance debugging Hydra. Feel free to add anything you would find
# useful to this.
runCommand "build-environment-info"
  {
    nativeBuildInputs = [ getent ] ++ lib.optionals stdenv.buildPlatform.isDarwin [ xcbuild ];
  }
  ''
    # It’s useful to get more info even if a command fails.
    set +e

    run() {
      echoCmd : "$@"
      "$@"
    }

    run uname -a

    ${lib.optionalString stdenv.buildPlatform.isDarwin ''
      run env SYSTEM_VERSION_COMPAT=0 plutil -p /System/Library/CoreServices/SystemVersion.plist
    ''}

    run id

    run getent passwd "$(id -un)"

    run ulimit -a

    # Always fail so that this job can easily be restarted.
    run exit 1
  ''