nixos-config/services/site-max.nix

42 lines
783 B
Nix
Raw Normal View History

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
};
services.nginx.virtualHosts = {
"max" = {
listen = [ { addr = "127.0.0.1"; port = cfg.port; } ];
locations."/" = {
root = pkgs.site-max;
};
};
};
};
}