]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/tools/cryptpad/default.nix
Add chatons infos
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / cryptpad / default.nix
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.chatonsProperties.hostings.cryptpad = {
36 file.datetime = "2022-08-21T01:20:00";
37 hosting = {
38 name = "Cryptpad";
39 description = "Collaboration suite, encrypted and open-source";
40 website = "https://cryptpad.immae.eu/";
41 logo = "https://cryptpad.immae.eu/customize/favicon/main-favicon.png";
42 type = "INSTANCE";
43 status.level = "OK";
44 status.description = "OK";
45 registration.load = "OPEN";
46 install.type = "PACKAGE";
47 };
48 };
49 myServices.chatonsProperties.services.cryptpad = {
50 file.datetime = "2022-08-21T01:20:00";
51 service = {
52 name = "Cryptpad";
53 description = "Collaboration suite, encrypted and open-source";
54 website = "https://cryptpad.immae.eu/";
55 logo = "https://cryptpad.immae.eu/customize/favicon/main-favicon.png";
56 status.level = "OK";
57 status.description = "OK";
58 registration."" = ["NONE" "FREE" "MEMBER" "CLIENT"];
59 registration.load = "OPEN";
60 install.type = "PACKAGE";
61 };
62 software = {
63 name = "Cryptpad";
64 website = "https://cryptpad.org/";
65 license.url = "https://github.com/xwiki-labs/cryptpad/blob/main/LICENSE";
66 license.name = "GNU Affero General Public License v3.0";
67 version = pkgs.cryptpad.version;
68 source.url = "https://github.com/xwiki-labs/cryptpad";
69 };
70 };
71 myServices.tools.cryptpad.farm.hosts.immaeEu = {
72 inherit domain port;
73 config = configFile;
74 };
75 services.websites.env.tools.modules = [ "proxy_wstunnel" ];
76 services.websites.env.tools.vhostConfs.cryptpad = {
77 certName = "eldiron";
78 addToCerts = true;
79 hosts = [domain];
80 root = config.myServices.tools.cryptpad.farm.vhostRoots.immaeEu;
81 extraConfig = [
82 config.myServices.tools.cryptpad.farm.vhosts.immaeEu
83 ];
84 };
85 };
86 }