]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/tools/cloud/default.nix
Add ldap
[perso/Immae/Config/Nix.git] / nixops / modules / websites / tools / cloud / default.nix
CommitLineData
9d90e7e2 1{ lib, pkgs, config, myconfig, mylibs, ... }:
10889174 2let
9d90e7e2
IB
3 nextcloud = pkgs.callPackage ./nextcloud.nix {
4 env = myconfig.env.tools.nextcloud;
5 };
10889174
IB
6
7 cfg = config.services.myWebsites.tools.cloud;
8in {
9 options.services.myWebsites.tools.cloud = {
10 enable = lib.mkEnableOption "enable cloud website";
11 };
12
13 config = lib.mkIf cfg.enable {
14 security.acme.certs."eldiron".extraDomains."cloud.immae.eu" = null;
15
16 services.myWebsites.tools.modules = nextcloud.apache.modules;
17
18 services.myWebsites.tools.vhostConfs.cloud = {
19 certName = "eldiron";
20 hosts = ["cloud.immae.eu" ];
a95ab089 21 root = nextcloud.apache.root;
10889174
IB
22 extraConfig = [
23 nextcloud.apache.vhostConf
24 ];
25 };
26
27 environment.systemPackages = let
28 occ = pkgs.writeScriptBin "nextcloud-occ" ''
29 #! ${pkgs.stdenv.shell}
30 cd ${nextcloud.webRoot}
31 NEXTCLOUD_CONFIG_DIR="${nextcloud.webRoot}/config" \
32 exec \
acaf5190 33 sudo -u wwwrun ${pkgs.php}/bin/php \
10889174
IB
34 -c ${pkgs.php}/etc/php.ini \
35 occ $*
36 '';
37 in [ occ ];
38
39 system.activationScripts.nextcloud = nextcloud.activationScript;
a95ab089
IB
40 system.extraSystemBuilderCmds = ''
41 mkdir -p $out/webapps
42 ln -s ${nextcloud.webRoot} $out/webapps/${nextcloud.apache.webappName}
43 '';
10889174
IB
44
45 services.myPhpfpm = {
46 poolPhpConfigs.nextcloud = nextcloud.phpFpm.phpConfig;
47 poolConfigs.nextcloud = nextcloud.phpFpm.pool;
48 };
49
9c35092c
IB
50 services.cron = {
51 enable = true;
52 systemCronJobs = [
53 ''
54 LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
55 */15 * * * * wwwrun ${pkgs.php}/bin/php -f ${nextcloud.webRoot}/cron.php
56 ''
57 ];
58 };
10889174
IB
59 };
60}