summaryrefslogtreecommitdiff
path: root/hostnix/elmo/cgithub.nix
blob: 45ca323196ec4d353385928a294f14297503ad89 (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
{ pkgs, ... }:

let
  # The Makefile copies cgithub/ next to this flake before rebuilding.
  cgithub = pkgs.callPackage ./packages/cgithub { src = ./cgithub; };
in
{
  systemd.sockets.cgithub = {
    wantedBy = [ "sockets.target" ];
    socketConfig = {
      ListenStream = "/run/cgithub/socket";
      SocketGroup = "nginx";
      SocketMode = "0660";
    };
  };

  systemd.services.cgithub = {
    requires = [ "cgithub.socket" ];
    after = [ "cgithub.socket" ];
    serviceConfig = {
      Type = "exec";
      DynamicUser = true;
      ExecStart = "${cgithub}/bin/cgithub-server";
    };
  };

  services.nginx.virtualHosts."fluffy-kitten.elmo.mou.fo" = {
    useACMEHost = "elmo.mou.fo";
    forceSSL = true;
    locations."/" = {
      proxyPass = "http://unix:/run/cgithub/socket";
    };
  };
}