]>
Commit | Line | Data |
---|---|---|
8c91e92c IB |
1 | { config, pkgs, lib, ... }: |
2 | let | |
3 | cfg = config.myServices.websites.tools.cryptpad; | |
4 | envCfg = config.myEnv.tools.cryptpad.immaeEu; | |
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.tools.cryptpad.farm.hosts.immaeEu = { | |
36 | inherit domain port; | |
37 | config = configFile; | |
38 | }; | |
39 | services.websites.env.tools.modules = [ "proxy_wstunnel" ]; | |
40 | services.websites.env.tools.vhostConfs.cryptpad = { | |
41 | certName = "eldiron"; | |
42 | addToCerts = true; | |
43 | hosts = [domain]; | |
44 | root = config.myServices.tools.cryptpad.farm.vhostRoots.immaeEu; | |
45 | extraConfig = [ | |
46 | config.myServices.tools.cryptpad.farm.vhosts.immaeEu | |
47 | ]; | |
48 | }; | |
49 | }; | |
50 | } |