From dbad6100b446cdcd26e6117bb236bda04e517cf1 Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Wed, 1 Jul 2020 22:36:23 +0100 Subject: add eth.sites.recipes --- nixos/modules/sites/recipes.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 nixos/modules/sites/recipes.nix (limited to 'nixos/modules/sites/recipes.nix') diff --git a/nixos/modules/sites/recipes.nix b/nixos/modules/sites/recipes.nix new file mode 100644 index 0000000..2312e56 --- /dev/null +++ b/nixos/modules/sites/recipes.nix @@ -0,0 +1,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}"; + }; + }; +} -- cgit v1.2.3