all repos — nixfiles @ 5f689657009cc14f916f967075c28596673e2ac4

System and user configuration, managed by nix and home-manager

system/roles/ci.nix (view raw)

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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
  config,
  inputs,
  pkgs,
  ...
}:
{
  systemd.services.laminar.environment = {
    NIX_PATH = "nixpkgs=flake:nixpkgs";
  };
  services.laminar = {
    enable = true;
    path = with pkgs; [
      fish
      bash
      gnutar
      bzip2
      gzip
      config.programs.git.package
      cached-nix-shell
      nix
      nix-build-uncached
      config.programs.ssh.package
      config.services.laminar.package
      moreutils
      flock
      just
      rsync
      go
    ];
    settings = {
      title = "CI";
      bindHTTP = "[::1]:8002";
      keepRundirs = 1;
      archiveURL = "https://ci.${config.networking.domain}/archive/";
    };
    timers = {
      update-flake-nix-packages = {
        startAt = "Saturday";
        accuracy = "6 hours";
        reason = "Weekly flake update";
      };
    };
  };
  users.users.laminar = {
    homeMode = "770";
  };
  users.groups.laminar.members = [ "caddy" ];

  services.caddy = {
    virtualHosts = {
      "ci.${config.networking.domain}" =
        let
          srv = config.services.laminar;
        in
        {
          extraConfig = ''
            reverse_proxy ${srv.settings.bindHTTP}
            handle_path /archive/* {
              root * ${srv.homeDir}/archive
              file_server browse
            }
          '';
        };
    };
  };

}