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

{
  systemd.tmpfiles.rules = [
    "d /opt 775 root root"
    "d /opt/garage 770 joe nginx"
  ];

  systemd.services.garage = {
    wantedBy = [ "multi-user.target" ];
    unitConfig = {
      AssertPathExists = "/opt/garage/serve.py";
    };
    serviceConfig = {
      WorkingDirectory = "/opt/garage";
      UMask = "002";
      User = "joe";
      Group = "nginx";
    };
    path = [ (pkgs.python3.withPackages (ps: [ ps.aiohttp ])) ];
    script = "python3 serve.py ./sock";
  };

  services.nginx.virtualHosts."ga.mou.fo" = {
    enableACME = true;
    forceSSL = true;
    locations."/".proxyPass = "http://unix:/opt/garage/sock";
  };
}