2023-06-10 12:50:53 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
2015-10-19 21:50:08 +02:00
|
|
|
let
|
|
|
|
cfg = config.krebs.retiolum-bootstrap;
|
2017-04-17 16:20:05 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.krebs.retiolum-bootstrap = {
|
|
|
|
enable = mkEnableOption "retiolum boot strap for ${cfg.serverName}";
|
|
|
|
serverName = mkOption {
|
2015-10-19 21:50:08 +02:00
|
|
|
type = types.str;
|
|
|
|
description = "hostname which serves tinc boot";
|
|
|
|
default = "tinc.krebsco.de" ;
|
|
|
|
};
|
2017-04-17 16:20:05 +02:00
|
|
|
sslCertificate = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = "Certificate file to use for ssl";
|
2023-09-07 19:00:57 +02:00
|
|
|
default = "${config.krebs.secret.directory}/tinc.krebsco.de.crt" ;
|
2015-10-20 19:59:59 +02:00
|
|
|
};
|
2017-04-17 16:20:05 +02:00
|
|
|
sslCertificateKey = mkOption {
|
2015-10-19 21:50:08 +02:00
|
|
|
type = types.str;
|
|
|
|
description = "Certificate key to use for ssl";
|
2023-09-07 19:00:57 +02:00
|
|
|
default = "${config.krebs.secret.directory}/tinc.krebsco.de.key";
|
2015-10-19 21:50:08 +02:00
|
|
|
};
|
|
|
|
# in use:
|
|
|
|
# <secrets/tinc.krebsco.de.crt>
|
|
|
|
# <secrets/tinc.krebsco.de.key>
|
|
|
|
};
|
|
|
|
|
2017-04-17 16:20:05 +02:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.nginx = {
|
|
|
|
enable = mkDefault true;
|
|
|
|
virtualHosts.retiolum-bootstrap = {
|
|
|
|
inherit (cfg) serverName sslCertificate sslCertificateKey;
|
2018-08-29 00:49:00 +02:00
|
|
|
forceSSL = true;
|
2017-04-17 16:20:05 +02:00
|
|
|
extraConfig =''
|
2015-10-20 19:59:59 +02:00
|
|
|
|
2015-10-19 21:50:08 +02:00
|
|
|
root ${pkgs.retiolum-bootstrap};
|
|
|
|
try_files $uri $uri/retiolum.sh;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2017-04-17 16:20:05 +02:00
|
|
|
}
|