]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/ressourcerie_banon/cryptpad.nix
Add cryptpad farm
[perso/Immae/Config/Nix.git] / modules / private / websites / ressourcerie_banon / cryptpad.nix
CommitLineData
54d97019
IB
1{ lib, pkgs, config, ... }:
2let
3 cfg = config.myServices.websites.ressourcerie_banon.cryptpad;
8c91e92c
IB
4 envCfg = config.myEnv.tools.cryptpad.ressourcerie_banon;
5 port = envCfg.port;
1feea3fe
IB
6 configFile = pkgs.writeText "config.js" ''
7 // ${pkgs.cryptpad}/lib/node_modules/cryptpad/config/config.example.js
8 module.exports = {
9 httpUnsafeOrigin: 'https://${domain}',
10 httpPort: ${toString port},
8c91e92c 11 adminEmail: '${envCfg.email}',
1feea3fe
IB
12 filePath: './datastore/',
13 archivePath: './data/archive',
14 pinPath: './data/pins',
15 taskPath: './data/tasks',
16 blockPath: './block',
17 blobPath: './blob',
18 blobStagingPath: './data/blobstage',
19 decreePath: './data/decrees',
20 logPath: './data/logs',
21 logToStdout: false,
22 logLevel: 'info',
23 logFeedback: false,
24 verbose: false,
8c91e92c
IB
25 inactiveTime: false,
26 adminKeys: ${builtins.toJSON envCfg.admins},
1feea3fe
IB
27 };
28 '';
29 domain = "pad.le-garage-autonome.org";
54d97019
IB
30in {
31 options.myServices.websites.ressourcerie_banon.cryptpad.enable = lib.mkEnableOption "Enable Ressourcerie Banon’s cryptpad";
32
33 config = lib.mkIf cfg.enable {
8c91e92c
IB
34 myServices.tools.cryptpad.farm.hosts.ressourcerie_banon = {
35 inherit domain port;
36 config = configFile;
54d97019 37 };
1feea3fe 38 services.websites.env.production.modules = [ "proxy_wstunnel" ];
54d97019
IB
39 services.websites.env.production.vhostConfs.ressourcerie_banon_cryptpad = {
40 certName = "ressourcerie_banon";
41 addToCerts = true;
1feea3fe 42 hosts = [domain];
8c91e92c 43 root = config.myServices.tools.cryptpad.farm.vhostRoots.ressourcerie_banon;
1feea3fe 44 extraConfig = [
8c91e92c 45 config.myServices.tools.cryptpad.farm.vhosts.ressourcerie_banon
1feea3fe 46 ];
54d97019
IB
47 };
48 };
49}