summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/deployment/gitlab.nix
blob: d61f50c1d2ee6aadf6dca67ce6529527b05206a7 (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, config, ... }:
let
  web-port = 19453;
  hostn = "gitlab.makefu.r";
  internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr;
in {

  services.gitlab = {
    enable = true;
    https = false;
    port = web-port;
    secrets = import <secrets/gitlab/secrets.nix>;
    databasePassword = import <secrets/gitlab/dbpw.nix>;
    initialRootEmail = "makefu@x.r";
    initialRootPassword = import <secrets/gitlab/rootpw.nix>;
    host = hostn;
    smtp = {
      enable = true;
      domain = "r";
      enableStartTLSAuto = false;
      port = 25;
    };
  };

  services.nginx = {
    enable = lib.mkDefault true;
    virtualHosts."${hostn}".locations."/" = {
        proxyPass  = "http://localhost:${toString web-port}/";
        extraConfig = ''
          if ( $server_addr != "${internal-ip}" ) {
            return 403;
          }
          proxy_set_header   Host             $host;
          proxy_set_header   X-Real-IP        $remote_addr;
          proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
      '';
    };
  };
}