]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - systems/eldiron/websites/cloud/default.nix
Move backup directory to host subdir
[perso/Immae/Config/Nix.git] / systems / eldiron / websites / cloud / default.nix
1 { lib, pkgs, config, ... }:
2 let
3 ncfg = config.myServices.tools.cloud.farm.instances.immae;
4 env = config.myEnv.tools.nextcloud;
5 cfg = config.myServices.websites.tools.cloud;
6 in {
7 options.myServices.websites.tools.cloud = {
8 enable = lib.mkEnableOption "enable cloud website";
9 };
10
11 config = lib.mkIf cfg.enable {
12 services.borgBackup.profiles.global.includedPaths = [
13 "nextcloud/appdata_occ80acffb591"
14 "nextcloud/files_external"
15 "nextcloud/config"
16 #"nextcloud/gpxpod"
17 "nextcloud/.ocdata"
18 "nextcloud/.htaccess"
19 "nextcloud/index.html"
20 ];
21 myServices.dns.zones."immae.eu".subdomains.cloud =
22 with config.myServices.dns.helpers; ips servers.eldiron.ips.main;
23
24 myServices.chatonsProperties.hostings.nextcloud = {
25 file.datetime = "2022-08-21T19:50:00";
26 hosting = {
27 name = "Nextcloud";
28 description = "The self-hosted productivity platform that keeps you in control";
29 website = "https://cloud.immae.eu/";
30 logo = "https://cloud.immae.eu/core/img/favicon.ico";
31 type = "INSTANCE";
32 status.level = "OK";
33 status.description = "OK";
34 registration.load = "OPEN";
35 install.type = "PACKAGE";
36 };
37 };
38 myServices.chatonsProperties.services.nextcloud = {
39 file.datetime = "2022-08-21T19:50:00";
40 service = {
41 name = "Nextcloud";
42 description = "The self-hosted productivity platform that keeps you in control";
43 website = "https://cloud.immae.eu/";
44 logo = "https://cloud.immae.eu/core/img/favicon.ico";
45 status.level = "OK";
46 status.description = "OK";
47 registration."" = ["MEMBER" "CLIENT"];
48 registration.load = "OPEN";
49 install.type = "PACKAGE";
50 guide.user = "https://www.immae.eu/docs/nextcloud.html";
51 };
52 software = {
53 name = "Nextcloud";
54 website = "https://nextcloud.com/";
55 license.url = "https://github.com/nextcloud/server/blob/master/COPYING";
56 license.name = "GNU Affero General Public License v3.0";
57 version = ncfg.rootDir.version;
58 source.url = "https://github.com/nextcloud/server";
59 modules = map (a: a.appName) ncfg.rootDir.apps;
60 };
61 };
62
63 myServices.tools.cloud.farm.instances.immae = {
64 nextcloud = pkgs.webapps-nextcloud_27.override ({
65 # Allow /index.php redirects
66 postInstall = ''
67 cd $out
68 ${pkgs.php81}/bin/php ${./add-htaccess.php} /
69 '';
70 });
71 apps = a: [
72 a.side_menu a.audioplayer a.bookmarks a.calendar a.carnet a.contacts
73 a.cookbook a.deck a.extract a.files_markdown a.files_mindmap
74 a.gpxpod a.keeweb a.maps a.metadata a.music
75 a.notes a.passman a.polls a.spreed a.tasks
76 ];
77 varDir = "/var/lib/nextcloud";
78 secretsPath = "webapps/tools-nextcloud";
79 phpPackage = pkgs.php81;
80 # Be careful when editing that: config from here takes
81 # precedence over the regular one, but if a key got removed, it my
82 # still exist in the default config file
83 config = let
84 env = config.myEnv.tools.nextcloud;
85 in {
86 "dbtype" = "pgsql";
87 "dbname" = env.postgresql.database;
88 "dbhost" = env.postgresql.socket;
89 "dbport" = "";
90 "dbtableprefix" = "oc_";
91 "dbuser" = env.postgresql.user;
92 "dbpassword" = env.postgresql.password;
93
94 "instanceid" = env.instance_id;
95 "passwordsalt" = env.password_salt;
96 "secret" = env.secret;
97
98 "trusted_domains" = [ "cloud.immae.eu" ];
99 "overwrite.cli.url" = "https://cloud.immae.eu";
100
101 "lost_password_link" = "disabled";
102
103 "remember_login_cookie_lifetime" = 60*60*24*30;
104 "session_keepalive" = true;
105 "session_lifefime" = 60*60*24*30;
106
107 "maxZipInputSize" = 0;
108 "allowZipDownload" = true;
109
110 # set by Carnet
111 "has_rebuilt_cache" = true;
112
113 "memcache.distributed" = "\\OC\\Memcache\\Redis";
114 "memcache.locking" = "\\OC\\Memcache\\Redis";
115 "filelocking.enabled" = true;
116 "redis" = {
117 "host" = env.redis.socket;
118 "port" = 0;
119 "dbindex" = env.redis.db;
120 };
121
122 "ldapIgnoreNamingRules" = false;
123 "ldapProviderFactory" = "\\OCA\\User_LDAP\\LDAPProviderFactory";
124
125 "mail_smtpmode" = "sendmail";
126 "mail_smtphost" = "127.0.0.1";
127 "mail_smtpname" = "";
128 "mail_smtppassword" = "";
129 "mail_from_address" = "nextcloud";
130 "mail_smtpauth" = false;
131 "mail_domain" = "tools.immae.eu";
132 };
133 };
134 services.websites.env.tools.modules = [ "proxy_fcgi" ];
135
136 security.acme.certs.eldiron.extraDomainNames = [ "cloud.immae.eu" ];
137 services.websites.env.tools.vhostConfs.cloud = {
138 certName = "eldiron";
139 hosts = ["cloud.immae.eu" ];
140 root = ncfg.rootDir;
141 extraConfig = [
142 ncfg.vhost
143 ];
144 };
145
146 myServices.monitoring.fromMasterActivatedPlugins = [ "http" ];
147 myServices.monitoring.fromMasterObjects.service = [
148 {
149 service_description = "owncloud website is running on cloud.immae.eu";
150 host_name = config.hostEnv.fqdn;
151 use = "external-web-service";
152 check_command = ["check_https" "cloud.immae.eu" "/" "a safe home for all your data"];
153
154 servicegroups = "webstatus-webapps";
155 _webstatus_name = "Nextcloud";
156 _webstatus_url = "https://cloud.immae.eu";
157 }
158 ];
159 };
160 }