2018-05-10 19:00:14 +02:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.site-max;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.site-max = {
|
|
|
|
enable = mkEnableOption "Site Max Spiegel";
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
example = 54321;
|
|
|
|
description = "Local listening port";
|
|
|
|
};
|
2018-05-17 15:43:35 +02:00
|
|
|
|
|
|
|
domaine = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = "example.com";
|
|
|
|
description = "Domaine à utiliser";
|
|
|
|
};
|
2018-05-10 19:00:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
services.haproxy-acme.services = {
|
2018-05-17 15:43:35 +02:00
|
|
|
${cfg.domaine} = { ip = "127.0.0.1"; port = cfg.port; auth = false; };
|
2018-05-10 19:00:14 +02:00
|
|
|
};
|
|
|
|
|
2018-09-16 16:29:26 +02:00
|
|
|
services.nginx = {
|
|
|
|
virtualHosts = {
|
|
|
|
"max" = {
|
|
|
|
listen = [ { addr = "127.0.0.1"; port = cfg.port; } ];
|
|
|
|
locations."/" = {
|
2018-11-10 15:23:46 +01:00
|
|
|
root = "/run/python-ci/nyanloutre/site-max";
|
2018-09-16 16:29:26 +02:00
|
|
|
};
|
2018-05-10 19:00:14 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|