blob: 29fc69afebee632e695531daac93dd7beab8ad3f [file] [log] [blame]
Skyler Greyfe1740c2023-10-21 01:24:18 +00001{ config, pkgs, lib, ... }: {
2 sops.secrets.clicks_nextcloud_db_password = {
3 mode = lib.mkForce "0440";
4 group = lib.mkForce "nextcloud";
5 };
Skyler Grey09c5cda2023-10-09 07:10:10 +00006
Skyler Greyfe1740c2023-10-21 01:24:18 +00007 users.users.nextcloud = {
8 isSystemUser = true;
9 createHome = true;
10 home = "/var/lib/nextcloud";
11 group = config.users.groups.nextcloud.name;
12 shell = pkgs.bashInteractive;
13 };
14 users.groups.nextcloud = { };
Skyler Grey09c5cda2023-10-09 07:10:10 +000015
Skyler Greyfe1740c2023-10-21 01:24:18 +000016 services.nextcloud.enable = true;
Skyler Grey4259e932023-10-21 21:37:03 +000017 services.nextcloud.https = true;
Skyler Greyfe1740c2023-10-21 01:24:18 +000018 services.nextcloud.config.adminpassFile =
19 config.sops.secrets.nextcloud_admin_password.path;
20 services.nextcloud.hostName = "nextcloud.clicks.codes";
Skyler Grey4259e932023-10-21 21:37:03 +000021 services.nginx.virtualHosts.${config.services.nextcloud.hostName} = {
22 enableACME = true;
23 forceSSL = true;
24 };
Skyler Greyfe1740c2023-10-21 01:24:18 +000025 services.nextcloud.package = pkgs.nextcloud27;
26 services.nextcloud.poolSettings = {
27 pm = "dynamic";
28 "pm.max_children" = "32";
29 "pm.max_requests" = "500";
30 "pm.max_spare_servers" = "4";
31 "pm.min_spare_servers" = "2";
32 "pm.start_servers" = "2";
33 "listen.owner" = config.users.users.nextcloud.name;
34 "listen.group" = config.users.users.nextcloud.group;
35 };
Skyler Grey09c5cda2023-10-09 07:10:10 +000036
Skyler Grey619aa3c2023-11-21 20:28:50 +000037 services.nextcloud.phpOptions."opcache.interned_strings_buffer" = "32";
38
Skyler Greyfe1740c2023-10-21 01:24:18 +000039 services.nextcloud.config = {
40 dbtype = "pgsql";
41 dbport = config.services.postgresql.port;
42 dbpassFile = config.sops.secrets.clicks_nextcloud_db_password.path;
43 dbname = "nextcloud";
44 dbhost = "localhost";
Skyler Grey4259e932023-10-21 21:37:03 +000045 extraTrustedDomains = [ "cloud.clicks.codes" "docs.clicks.codes" ];
Skyler Greyfe1740c2023-10-21 01:24:18 +000046 };
Skyler Grey09c5cda2023-10-09 07:10:10 +000047
Skyler Grey619aa3c2023-11-21 20:28:50 +000048 services.nextcloud.extraOptions = {
49 social_login_auto_redirect = true;
50 default_phone_region = "US";
51 "overwrite.cli.url" = "https://nextcloud.clicks.codes";
52 };
Skyler Grey09c5cda2023-10-09 07:10:10 +000053
Skyler Grey915067d2023-12-03 13:46:53 +000054 services.nextcloud.notify_push.enable = false;
55 services.nextcloud.configureRedis = true;
56
Skyler Greyfe1740c2023-10-21 01:24:18 +000057 services.nextcloud.extraApps = {
58 sociallogin = pkgs.fetchNextcloudApp {
59 url =
60 "https://github.com/zorn-v/nextcloud-social-login/releases/download/v5.5.3/release.tar.gz";
61 sha256 = "sha256-96/wtK7t23fXVRcntDONjgb5bYtZuaNZzbvQCa5Gsj4=";
Skyler Grey915067d2023-12-03 13:46:53 +000062 license = "agpl3Only";
Skyler Grey9ae213d2023-10-10 23:43:29 +000063 };
Skyler Greyfe1740c2023-10-21 01:24:18 +000064 richdocuments = pkgs.fetchNextcloudApp {
65 url =
66 "https://github.com/nextcloud-releases/richdocuments/releases/download/v8.2.0/richdocuments-v8.2.0.tar.gz";
67 sha256 = "sha256-PKw7FXSWvden2+6XjnUDOvbTF71slgeTF/ktS/l2+Dk=";
Skyler Grey915067d2023-12-03 13:46:53 +000068 license = "agpl3Only";
Skyler Greyfe1740c2023-10-21 01:24:18 +000069 };
Skyler Greya0f44522023-10-24 17:40:40 +000070 calendar = pkgs.fetchNextcloudApp {
71 url =
72 "https://github.com/nextcloud-releases/calendar/releases/download/v4.5.2/calendar-v4.5.2.tar.gz";
73 sha256 = "sha256-n7GjgAyw2SLoZTEfakmI3IllWUk6o1MF89Zt3WGhR6A=";
Skyler Grey915067d2023-12-03 13:46:53 +000074 license = "agpl3Only";
Skyler Greya0f44522023-10-24 17:40:40 +000075 };
76 contacts = pkgs.fetchNextcloudApp {
77 url =
78 "https://github.com/nextcloud-releases/contacts/releases/download/v5.4.2/contacts-v5.4.2.tar.gz";
79 sha256 = "sha256-IkKHJ3MY/UPZqa4H86WGOEOypffMIHyJ9WvMqkq/4t8=";
Skyler Grey915067d2023-12-03 13:46:53 +000080 license = "agpl3Only";
Skyler Greya0f44522023-10-24 17:40:40 +000081 };
Skyler Grey1a0117e2023-11-01 10:00:40 +000082 tasks = pkgs.fetchNextcloudApp {
83 url =
84 "https://github.com/nextcloud/tasks/releases/download/v0.15.0/tasks.tar.gz";
85 sha256 = "sha256-zMMqtEWiXmhB1C2IeWk8hgP7eacaXLkT7Tgi4NK6PCg=";
Skyler Grey915067d2023-12-03 13:46:53 +000086 license = "agpl3Only";
Skyler Grey1a0117e2023-11-01 10:00:40 +000087 };
88 appointments = pkgs.fetchNextcloudApp {
89 url =
90 "https://github.com/SergeyMosin/Appointments/raw/v1.15.4/build/artifacts/appstore/appointments.tar.gz";
91 sha256 = "sha256-2Oo7MJBPiBUBf4kti4or5nX+QiXT1Tkw3KowUGCj67E=";
Skyler Grey915067d2023-12-03 13:46:53 +000092 license = "agpl3Only";
Skyler Grey1a0117e2023-11-01 10:00:40 +000093 };
Skyler Grey0b140a82023-11-07 19:26:13 +000094 mail = pkgs.fetchNextcloudApp {
95 url =
96 "https://github.com/nextcloud-releases/mail/releases/download/v3.4.4/mail-v3.4.4.tar.gz";
97 sha256 = "sha256-2+EUVjeFW0mrnR23aU5UHZtGjqpDE11qHXu6PWhUTCs=";
Skyler Grey915067d2023-12-03 13:46:53 +000098 license = "agpl3Only";
Skyler Grey0b140a82023-11-07 19:26:13 +000099 };
100 spreed = pkgs.fetchNextcloudApp { # nextcloud talk
101 url =
102 "https://github.com/nextcloud-releases/spreed/releases/download/v17.1.2/spreed-v17.1.2.tar.gz";
103 sha256 = "sha256-OvZD/k1t4MAJ/BXbHzli6+V/bsgzE6iZQGrC9cG3b8E=";
Skyler Grey915067d2023-12-03 13:46:53 +0000104 license = "agpl3Only";
Skyler Grey0b140a82023-11-07 19:26:13 +0000105 };
106 notes = pkgs.fetchNextcloudApp {
107 url =
108 "https://github.com/nextcloud-releases/notes/releases/download/v4.8.1/notes.tar.gz";
109 sha256 = "sha256-7GkTGyGTvtDbZsq/zOdbBE7xh6DZO183W6I5XX1ekbw=";
Skyler Grey915067d2023-12-03 13:46:53 +0000110 license = "agpl3Only";
Skyler Grey0b140a82023-11-07 19:26:13 +0000111 };
Samuel Shuert578f6b52023-11-24 18:49:06 -0500112 files_3dmodelviewer = pkgs.fetchNextcloudApp {
113 url =
114 "https://github.com/WARP-LAB/files_3dmodelviewer/releases/download/v0.0.12/files_3dmodelviewer.tar.gz";
115 sha256 = "sha256-JKlHDB6VFUXv7V+TzWSgJeuvR2Z+oXGKFZgZtX2A9pA=";
Skyler Grey915067d2023-12-03 13:46:53 +0000116 license = "agpl3Only";
Samuel Shuert578f6b52023-11-24 18:49:06 -0500117 };
Samuel Shuert7e8f5722023-11-27 13:02:25 -0500118 external = pkgs.fetchNextcloudApp {
119 url =
120 "https://github.com/nextcloud-releases/external/releases/download/v5.2.1/external-v5.2.1.tar.gz";
121 sha256 = "sha256-X7eC8T8wSZGVwCQp6U/WxjMC7aIj39osgHotaUoRNSQ=";
Skyler Grey915067d2023-12-03 13:46:53 +0000122 license = "agpl3Only";
Samuel Shuert7e8f5722023-11-27 13:02:25 -0500123 };
Skyler Greyfe1740c2023-10-21 01:24:18 +0000124 };
Skyler Grey9ae213d2023-10-10 23:43:29 +0000125
Skyler Greyfe1740c2023-10-21 01:24:18 +0000126 sops.secrets.nextcloud_admin_password = {
127 mode = "0600";
128 owner = config.users.users.nextcloud.name;
129 group = config.users.users.nextcloud.group;
Samuel Shuertf68685d2023-10-28 20:07:56 -0400130 sopsFile = ../../secrets/nextcloud.json;
Skyler Greyfe1740c2023-10-21 01:24:18 +0000131 format = "json";
132 };
Skyler Grey7337ee52023-12-03 11:58:17 +0000133
Skyler Grey915067d2023-12-03 13:46:53 +0000134 systemd.services.nextcloud-setup.requires = [ "postgresql.service" ];
Skyler Grey7337ee52023-12-03 11:58:17 +0000135 systemd.services.nextcloud-cron.requires = [ "postgresql.service" ];
Skyler Grey915067d2023-12-03 13:46:53 +0000136 systemd.services.nextcloud-notify_push.requires = [ "postgresql.service" ];
Skyler Grey13420dc2023-10-10 22:23:26 +0000137}