2023-06-10 10:50:53 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
with 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";
|
2023-09-07 17:00:57 +00:00
|
|
|
default = "${config.krebs.secret.directory}/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";
|
2023-09-07 17:00:57 +00:00
|
|
|
default = "${config.krebs.secret.directory}/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
|
|
|
}
|