]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/ressourcerie_banon/cryptpad.nix
961302da866d5f42dbd870a8b4e1bebcd755c174
[perso/Immae/Config/Nix.git] / modules / private / websites / ressourcerie_banon / cryptpad.nix
1 { lib, pkgs, config, ... }:
2 let
3 cfg = config.myServices.websites.ressourcerie_banon.cryptpad;
4 configFile = "${pkgs.cryptpad}/lib/node_modules/cryptpad/config/config.example.js";
5 in {
6 options.myServices.websites.ressourcerie_banon.cryptpad.enable = lib.mkEnableOption "Enable Ressourcerie Banon’s cryptpad";
7
8 config = lib.mkIf cfg.enable {
9 systemd.services.cryptpad-ressourcerie_banon = {
10 description = "Cryptpad Banon Service";
11 wantedBy = [ "multi-user.target" ];
12 after = [ "networking.target" ];
13 serviceConfig = {
14 DynamicUser = true;
15 Environment = [
16 "CRYPTPAD_CONFIG=${configFile}"
17 "HOME=%S/cryptpad/ressourcerie_banon"
18 ];
19 ExecStart = "${pkgs.cryptpad}/bin/cryptpad";
20 PrivateTmp = true;
21 Restart = "always";
22 StateDirectory = "cryptpad/ressourcerie_banon";
23 WorkingDirectory = "%S/cryptpad/ressourcerie_banon";
24 };
25 };
26 services.websites.env.production.vhostConfs.ressourcerie_banon_cryptpad = {
27 certName = "ressourcerie_banon";
28 addToCerts = true;
29 hosts = ["pad.le-garage-autonome.org"];
30 root = null;
31 };
32 };
33 }