summaryrefslogtreecommitdiffstats
path: root/nixos/tests/hydra/common.nix
blob: 60c7143acc29b12a0d54a0d938ec28727f649032 (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
40
41
42
43
44
45
46
47
48
49
{
  baseConfig =
    { pkgs, ... }:
    let
      trivialJob = pkgs.writeTextDir "trivial.nix" ''
        { trivial = derivation {
            name = "trivial";
            system = "${pkgs.stdenv.hostPlatform.system}";
            builder = "/bin/sh";
            allowSubstitutes = false;
            preferLocalBuild = true;
            args = ["-c" "echo success > $out; exit 0"];
          };
        }
      '';

      createTrivialProject = pkgs.stdenv.mkDerivation {
        name = "create-trivial-project";
        dontUnpack = true;
        nativeBuildInputs = [ pkgs.makeWrapper ];
        installPhase = "install -m755 -D ${./create-trivial-project.sh} $out/bin/create-trivial-project.sh";
        postFixup = ''
          wrapProgram "$out/bin/create-trivial-project.sh" --prefix PATH ":" ${
            pkgs.lib.makeBinPath [ pkgs.curl ]
          } --set EXPR_PATH ${trivialJob}
        '';
      };
    in
    {
      virtualisation.memorySize = 2048;
      time.timeZone = "UTC";
      environment.systemPackages = [
        createTrivialProject
        pkgs.jq
      ];
      services.hydra = {
        enable = true;
        # Hydra needs those settings to start up, so we add something not harmfull.
        hydraURL = "example.com";
        notificationSender = "example@example.com";
        extraConfig = ''
          email_notification = 1
        '';
      };
      services.postfix.enable = true;
      nix.settings.substituters = [ ];
      nix.enable = true; # disabled by default. See all-tests.nix / tag(no-nix-by-default)
    };
}