Added mailserver and hedgedoc service

This commit is contained in:
Julien Malka 2022-01-23 19:11:10 +01:00
parent 5e0aeec052
commit 8b47b55ecf
No known key found for this signature in database
GPG key ID: 3C68E13964FEA07F
7 changed files with 201 additions and 4 deletions

55
modules/docs/default.nix Normal file
View file

@ -0,0 +1,55 @@
{ lib, pkgs, config, ... }:
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;
configuration = {
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";
}
];
};
}
(mkIf cfg.nginx.enable (mkSubdomain cfg.nginx.subdomain port))]);
}