summaryrefslogtreecommitdiff
path: root/nixos/modules/sites/recipes.nix
blob: 2312e56c02f266e79b2c51aceab6f286ca791174 (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
{ config, lib, pkgs, ... }:
with lib;

let
  cfg = config.eth.sites.recipes;

in {
  options.eth.sites.recipes = {
    enable = mkEnableOption "Whether to enable recipes.";

    https = mkOption {
      type = types.bool;
      default = true;
      description = "Whether to enable HTTPS.";
    };

    virtualHost = mkOption {
      type = types.str;
      default = "_";
      description = "Virtual Host to install the site under in Nginx.";
      example = "git.eth.moe";
    };
  };

  config = mkIf cfg.enable {
    services.nginx.virtualHosts.${cfg.virtualHost} = {
      forceSSL = cfg.https;
      enableACME = cfg.https;
      root = "${pkgs.eth.recipes}";
    };
  };
}