stockholm/krebs/3modules/retiolum-bootstrap.nix

44 lines
1.2 KiB
Nix
Raw Normal View History

2023-06-10 10:50:53 +00:00
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.krebs.retiolum-bootstrap;
in
{
options.krebs.retiolum-bootstrap = {
enable = mkEnableOption "retiolum boot strap for ${cfg.serverName}";
serverName = mkOption {
type = types.str;
description = "hostname which serves tinc boot";
default = "tinc.krebsco.de" ;
};
sslCertificate = mkOption {
type = types.str;
description = "Certificate file to use for ssl";
default = "${config.krebs.secret.directory}/tinc.krebsco.de.crt" ;
};
sslCertificateKey = mkOption {
type = types.str;
description = "Certificate key to use for ssl";
default = "${config.krebs.secret.directory}/tinc.krebsco.de.key";
};
# in use:
# ${config.krebs.secret.directory}/tinc.krebsco.de.crt
# ${config.krebs.secret.directory}/tinc.krebsco.de.key
};
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;
extraConfig =''
root ${pkgs.retiolum-bootstrap};
try_files $uri $uri/retiolum.sh;
'';
};
};
};
}