aboutsummaryrefslogtreecommitdiff
path: root/modules/nixos/services/web/images/default.nix
blob: b1c44e6b87f7ea51333abd5db6fdd5ee189912db (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
{ options, config, lib, namespace, ... }:

with lib; with lib.${namespace}; let
  cfg = config.${namespace}.services.web.images;
  impermanence = config.${namespace}.system.impermanence;
in {
  options.${namespace}.services.web.images = with types; {
    enable = mkEnableOption "image webserver";
  };

  config = mkIf cfg.enable {
    cxl.services.web.enable = true;

    environment.persistence.${impermanence.location} = {
      directories = [
        "/srv/web/images"
      ];
    };

    networking.firewall.allowedTCPPorts = [ 80 443 ];
    
    services.nginx = {
      enable = true;
      virtualHosts = {
        "i.cxl.sh" = {
          addSSL = true;
          enableACME = true;

          root = "/srv/web/images";
        };
      };
    };
  };
}