snowfield/modules/docs/default.nix

59 lines
1.2 KiB
Nix
Raw Normal View History

2024-03-30 20:18:12 +01:00
{ lib, config, ... }:
2022-01-23 19:11:10 +01:00
with lib;
let
cfg = config.luj.docs;
port = 3013;
in
{
options.luj.docs = {
enable = mkEnableOption "activate hedgedoc service";
nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption {
type = types.str;
};
};
config = mkIf cfg.enable (
mkMerge [{
services.hedgedoc = {
enable = true;
2023-01-05 17:01:15 +01:00
settings = {
2022-01-23 19:11:10 +01:00
port = port;
db = {
dialect = "postgres";
host = "/run/postgresql";
};
domain = "docs.julienmalka.me";
protocolUseSSL = true;
allowFreeURL = true;
allowEmailRegister = false;
allowAnonymous = false;
allowAnonymousEdits = true;
allowGravatar = true;
};
};
services.postgresql = {
ensureDatabases = [ "hedgedoc" ];
ensureUsers = [
{
name = "hedgedoc";
ensurePermissions."DATABASE hedgedoc" = "ALL PRIVILEGES";
}
];
};
}
2022-02-26 18:55:41 +01:00
(mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port))
2023-01-05 17:01:15 +01:00
2022-02-26 18:55:41 +01:00
(mkIf cfg.nginx.enable (mkVPNSubdomain cfg.nginx.subdomain port))]);
2023-01-05 17:01:15 +01:00
2022-01-23 19:11:10 +01:00
}