This repository has no description
1.8 kB
62 lines
1{ self, lib, config, ... }:
2{
3 imports = [
4 self.inputs.clan-core.clanModules.postgresql
5 ];
6 clan.postgresql.users.hedgedoc = {};
7 clan.postgresql.databases.hedgedoc = {};
8 options.clan.hedgedoc = {
9 domain = lib.mkOption {
10 type = lib.types.str;
11 description = "The domain of the hedgedoc instance.";
12 };
13 };
14 systemd.services.hedgedoc.environment = {
15 CMD_COOKIE_POLICY = "none";
16 CMD_CSP_ALLOW_FRAMING = "true";
17 };
18
19 services.hedgedoc = {
20 enable = true;
21 settings = {
22 allowOrigin = [ config.clan.hedgedoc.domain ];
23 db = {
24 dialect = "postgres";
25 host = "/run/postgresql";
26 database = "hedgedoc";
27 username = "hedgedoc";
28 };
29 # db = {
30 # dialect = "sqlite";
31 # storage = "/var/lib/hedgedoc/db.hedgedoc.sqlite";
32 # };
33 useCDN = false;
34 port = 3091;
35 domain = config.hedgedoc.domain;
36 allowFreeURL = true;
37 defaultPermission = "freely";
38
39 useSSL = true;
40 protocolUseSSL = true;
41 sslCAPath = [ "/etc/ssl/certs/ca-certificates.crt" ];
42 sslCertPath = "/var/lib/acme/${config.clan.hedgedoc.domain}/cert.pem";
43 sslKeyPath = "/var/lib/acme/${config.clan.hedgedoc.domain}/key.pem";
44 dhParamPath = config.security.dhparams.params.hedgedoc.path;
45 };
46
47 # https://github.com/settings/applications/2352617
48 environmentFile = config.clanCore.facts.secretUploadDirectory + "/hedgedoc.env";
49 };
50
51 clanCore.facts.services.hedgedoc-github-auth = {
52 secret."hedgedoc.env" = { };
53 generator.script = ''
54 cat > "$secrets"/hedgedoc.env
55 '';
56 generator.prompt = ''
57 goto https://github.com/settings/ap:qplications/2352617 and paste the data in the following format:
58 GITHUB_CLIENT_ID=...
59 GITHUB_CLIENT_SECRET=...
60 '';
61 };
62}