2017-04-17 14:20:05 +00:00
|
|
|
{ config, pkgs, ... }:
|
2016-10-20 18:54:38 +00:00
|
|
|
with import <stockholm/lib>;
|
2015-10-19 19:50:08 +00:00
|
|
|
let
|
|
|
|
cfg = config.krebs.retiolum-bootstrap;
|
2017-04-17 14:20:05 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.krebs.retiolum-bootstrap = {
|
|
|
|
enable = mkEnableOption "retiolum boot strap for ${cfg.serverName}";
|
|
|
|
serverName = mkOption {
|
2015-10-19 19:50:08 +00:00
|
|
|
type = types.str;
|
|
|
|
description = "hostname which serves tinc boot";
|
|
|
|
default = "tinc.krebsco.de" ;
|
|
|
|
};
|
2017-04-17 14:20:05 +00:00
|
|
|
sslCertificate = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = "Certificate file to use for ssl";
|
|
|
|
default = "${toString <secrets>}/tinc.krebsco.de.crt" ;
|
2015-10-20 17:59:59 +00:00
|
|
|
};
|
2017-04-17 14:20:05 +00:00
|
|
|
sslCertificateKey = mkOption {
|
2015-10-19 19:50:08 +00:00
|
|
|
type = types.str;
|
|
|
|
description = "Certificate key to use for ssl";
|
2016-07-18 13:13:22 +00:00
|
|
|
default = "${toString <secrets>}/tinc.krebsco.de.key";
|
2015-10-19 19:50:08 +00:00
|
|
|
};
|
|
|
|
# in use:
|
|
|
|
# <secrets/tinc.krebsco.de.crt>
|
|
|
|
# <secrets/tinc.krebsco.de.key>
|
|
|
|
};
|
|
|
|
|
2017-04-17 14:20:05 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.nginx = {
|
|
|
|
enable = mkDefault true;
|
|
|
|
virtualHosts.retiolum-bootstrap = {
|
|
|
|
inherit (cfg) serverName sslCertificate sslCertificateKey;
|
2018-08-28 22:49:00 +00:00
|
|
|
forceSSL = true;
|
2017-04-17 14:20:05 +00:00
|
|
|
extraConfig =''
|
2015-10-20 17:59:59 +00:00
|
|
|
|
2015-10-19 19:50:08 +00:00
|
|
|
root ${pkgs.retiolum-bootstrap};
|
|
|
|
try_files $uri $uri/retiolum.sh;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2017-04-17 14:20:05 +00:00
|
|
|
}
|