]>
Commit | Line | Data |
---|---|---|
1a64deeb IB |
1 | { config, pkgs, lib, ... }: |
2 | let | |
3 | cfg = config.myServices.websites.tools.cryptpad; | |
4 | envCfg = config.myEnv.tools.cryptpad; | |
5 | domain = "cryptpad.immae.eu"; | |
6 | port = envCfg.port; | |
7 | configFile = pkgs.writeText "config.js" '' | |
8 | // ${pkgs.cryptpad}/lib/node_modules/cryptpad/config/config.example.js | |
9 | module.exports = { | |
10 | httpUnsafeOrigin: 'https://${domain}', | |
11 | httpPort: ${toString port}, | |
12 | adminEmail: '${envCfg.email}', | |
13 | filePath: './datastore/', | |
14 | archivePath: './data/archive', | |
15 | pinPath: './data/pins', | |
16 | taskPath: './data/tasks', | |
17 | blockPath: './block', | |
18 | blobPath: './blob', | |
19 | blobStagingPath: './data/blobstage', | |
20 | decreePath: './data/decrees', | |
21 | logPath: './data/logs', | |
22 | logToStdout: false, | |
23 | logLevel: 'info', | |
24 | logFeedback: false, | |
25 | verbose: false, | |
26 | inactiveTime: false, | |
27 | maxUploadSize: 100 * 1024 * 1024, | |
28 | adminKeys: ${builtins.toJSON envCfg.admins}, | |
29 | }; | |
30 | ''; | |
31 | in | |
32 | { | |
33 | options.myServices.websites.tools.cryptpad.enable = lib.mkEnableOption "Enable Cryptpad"; | |
34 | config = lib.mkIf cfg.enable { | |
35 | myServices.dns.zones."immae.eu".subdomains.cryptpad = | |
36 | with config.myServices.dns.helpers; ips servers.eldiron.ips.main; | |
37 | ||
38 | myServices.chatonsProperties.hostings.cryptpad = { | |
39 | file.datetime = "2022-08-21T01:20:00"; | |
40 | hosting = { | |
41 | name = "Cryptpad"; | |
42 | description = "Collaboration suite, encrypted and open-source"; | |
43 | website = "https://cryptpad.immae.eu/"; | |
44 | logo = "https://cryptpad.immae.eu/customize/favicon/main-favicon.png"; | |
45 | type = "INSTANCE"; | |
46 | status.level = "OK"; | |
47 | status.description = "OK"; | |
48 | registration.load = "OPEN"; | |
49 | install.type = "PACKAGE"; | |
50 | }; | |
51 | }; | |
52 | myServices.chatonsProperties.services.cryptpad = { | |
53 | file.datetime = "2022-08-21T01:20:00"; | |
54 | service = { | |
55 | name = "Cryptpad"; | |
56 | description = "Collaboration suite, encrypted and open-source"; | |
57 | website = "https://cryptpad.immae.eu/"; | |
58 | logo = "https://cryptpad.immae.eu/customize/favicon/main-favicon.png"; | |
59 | status.level = "OK"; | |
60 | status.description = "OK"; | |
61 | registration."" = ["NONE" "FREE" "MEMBER" "CLIENT"]; | |
62 | registration.load = "OPEN"; | |
63 | install.type = "PACKAGE"; | |
64 | }; | |
65 | software = { | |
66 | name = "Cryptpad"; | |
67 | website = "https://cryptpad.org/"; | |
68 | license.url = "https://github.com/xwiki-labs/cryptpad/blob/main/LICENSE"; | |
69 | license.name = "GNU Affero General Public License v3.0"; | |
70 | version = pkgs.cryptpad.version; | |
71 | source.url = "https://github.com/xwiki-labs/cryptpad"; | |
72 | }; | |
73 | }; | |
74 | myServices.tools.cryptpad.farm.hosts.immaeEu = { | |
75 | inherit domain port; | |
76 | config = configFile; | |
77 | }; | |
78 | services.websites.env.tools.modules = [ "proxy_wstunnel" ]; | |
79 | security.acme.certs.eldiron.extraDomainNames = [ domain ]; | |
80 | services.websites.env.tools.vhostConfs.cryptpad = { | |
81 | certName = "eldiron"; | |
82 | hosts = [domain]; | |
83 | root = config.myServices.tools.cryptpad.farm.vhostRoots.immaeEu; | |
84 | extraConfig = [ | |
85 | config.myServices.tools.cryptpad.farm.vhosts.immaeEu | |
86 | ]; | |
87 | }; | |
88 | }; | |
89 | } |