summary refs log tree commit diff
path: root/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
blob: 5daacfb6efc45eccc61e78021d210fdbac4e6b2e (plain) (blame)
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
{ config, pkgs, lib, spacebar-server, secrets, ... }:

{
    containers."spacebarchat-server-dev-nix" = import ./container.nix {
      inherit pkgs lib spacebar-server;
    };

    security.acme.certs."dev-nix.server.spacebar.chat" = {
      domain = "dev-nix.server.spacebar.chat";
      extraDomainNames = [ "*.dev-nix.server.spacebar.chat" ];
      group = "nginx";
      dnsProvider = "cloudflare";
      credentialsFile = pkgs.writeTextFile {
        name = "cloudflare-credentials";
        text = ''
          # Cloudflare API credentials used by lego
          # https://go-acme.github.io/lego/dns/cloudflare/
          CLOUDFLARE_DNS_API_TOKEN=${secrets.secret_keys.cloudflare_dns}
        '';
      };
    };

    services.nginx.virtualHosts."*.dev-nix.server.spacebar.chat" = {
      serverName = "*.dev-nix.server.spacebar.chat";
      useACMEHost = "dev-nix.server.spacebar.chat";
      forceSSL = true;
      locations."/" = {
        proxyPass = "http://192.168.100.1";
      };
    };
    services.nginx.virtualHosts."dev-nix.server.spacebar.chat" = {
      serverName = "dev-nix.server.spacebar.chat";
      useACMEHost = "dev-nix.server.spacebar.chat";
      forceSSL = true;
      locations."/" = {
        proxyPass = "http://192.168.100.1";
      };
    };

  system.stateVersion = "22.11"; # DO NOT EDIT!
}