diff options
-rw-r--r-- | modules/private/default.nix | 2 | ||||
-rw-r--r-- | modules/private/system/quatresaisons/nextcloud.nix | 2 | ||||
-rw-r--r-- | modules/private/websites/bakeer/cloud.nix | 115 | ||||
-rw-r--r-- | modules/private/websites/default.nix | 1 | ||||
-rw-r--r-- | modules/private/websites/tools/cloud/default.nix | 2 | ||||
m--------- | nixops/secrets | 0 | ||||
-rw-r--r-- | pkgs/webapps/nextcloud/apps/impersonate.nix | 9 | ||||
-rw-r--r-- | pkgs/webapps/nextcloud/default.nix | 6 |
8 files changed, 132 insertions, 5 deletions
diff --git a/modules/private/default.nix b/modules/private/default.nix index b821488..ddc4281 100644 --- a/modules/private/default.nix +++ b/modules/private/default.nix | |||
@@ -19,6 +19,8 @@ set = { | |||
19 | 19 | ||
20 | 20 | ||
21 | # Personal websites | 21 | # Personal websites |
22 | bakeerCloud = ./websites/bakeer/cloud.nix; | ||
23 | |||
22 | capitainesLandingPages = ./websites/capitaines/landing_pages.nix; | 24 | capitainesLandingPages = ./websites/capitaines/landing_pages.nix; |
23 | 25 | ||
24 | chloeInte = ./websites/chloe/integration.nix; | 26 | chloeInte = ./websites/chloe/integration.nix; |
diff --git a/modules/private/system/quatresaisons/nextcloud.nix b/modules/private/system/quatresaisons/nextcloud.nix index 047d17e..89d69d5 100644 --- a/modules/private/system/quatresaisons/nextcloud.nix +++ b/modules/private/system/quatresaisons/nextcloud.nix | |||
@@ -95,7 +95,7 @@ in { | |||
95 | cd ${nextcloud} | 95 | cd ${nextcloud} |
96 | NEXTCLOUD_CONFIG_DIR="${nextcloud}/config" \ | 96 | NEXTCLOUD_CONFIG_DIR="${nextcloud}/config" \ |
97 | exec \ | 97 | exec \ |
98 | sudo -u wwwrun ${pkgs.php74}/bin/php \ | 98 | sudo -E -u wwwrun ${pkgs.php74}/bin/php \ |
99 | -c ${pkgs.php74}/etc/php.ini \ | 99 | -c ${pkgs.php74}/etc/php.ini \ |
100 | occ $* | 100 | occ $* |
101 | ''; | 101 | ''; |
diff --git a/modules/private/websites/bakeer/cloud.nix b/modules/private/websites/bakeer/cloud.nix new file mode 100644 index 0000000..001ca03 --- /dev/null +++ b/modules/private/websites/bakeer/cloud.nix | |||
@@ -0,0 +1,115 @@ | |||
1 | { lib, pkgs, config, ... }: | ||
2 | let | ||
3 | cfg = config.myServices.websites.bakeer.cloud; | ||
4 | varDir = "/var/lib/nextcloud_farm/bakeer"; | ||
5 | apacheUser = config.services.httpd.Prod.user; | ||
6 | apacheGroup = config.services.httpd.Prod.group; | ||
7 | nextcloud = (pkgs.webapps.nextcloud.override { varDir = null; }).withApps (a: [ | ||
8 | a.apporder a.audioplayer a.bookmarks a.calendar a.carnet a.contacts | ||
9 | a.cookbook a.deck a.extract a.files_markdown a.files_readmemd | ||
10 | a.flowupload a.gpxedit a.gpxpod a.impersonate a.keeweb a.maps | ||
11 | a.metadata a.music a.notes a.ocsms a.passman a.polls a.spreed | ||
12 | a.tasks | ||
13 | ]); | ||
14 | phpBaseDir = builtins.concatStringsSep ":" ([ nextcloud varDir ] ++ nextcloud.apps); | ||
15 | in { | ||
16 | options.myServices.websites.bakeer.cloud.enable = lib.mkEnableOption "enable Bakeer’s cloud"; | ||
17 | |||
18 | config = lib.mkIf cfg.enable { | ||
19 | system.activationScripts.bakeer_cloud = { | ||
20 | deps = [ "httpd" ]; | ||
21 | text = '' | ||
22 | install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d ${varDir} | ||
23 | install -m 0755 -o ${apacheUser} -g ${apacheGroup} -d /var/lib/nextcloud_farm/phpSessions | ||
24 | ''; | ||
25 | }; | ||
26 | systemd.services.phpfpm-nextcloud_farm.after = lib.mkAfter [ "postgresql.service" ]; | ||
27 | systemd.services.phpfpm-nextcloud_farm.wants = [ "postgresql.service" ]; | ||
28 | services.phpfpm.pools.nextcloud_farm = { | ||
29 | user = apacheUser; | ||
30 | group = apacheGroup; | ||
31 | settings = { | ||
32 | "listen.owner" = apacheUser; | ||
33 | "listen.group" = apacheGroup; | ||
34 | "pm" = "ondemand"; | ||
35 | "pm.max_children" = "60"; | ||
36 | "pm.process_idle_timeout" = "60"; | ||
37 | |||
38 | "php_admin_value[output_buffering]" = "0"; | ||
39 | "php_admin_value[max_execution_time]" = "1800"; | ||
40 | "php_admin_value[zend_extension]" = "opcache"; | ||
41 | #already enabled by default? | ||
42 | #"php_value[opcache.enable]" = "1"; | ||
43 | "php_value[opcache.enable_cli]" = "1"; | ||
44 | "php_value[opcache.interned_strings_buffer]" = "8"; | ||
45 | "php_value[opcache.max_accelerated_files]" = "10000"; | ||
46 | "php_value[opcache.memory_consumption]" = "128"; | ||
47 | "php_value[opcache.save_comments]" = "1"; | ||
48 | "php_value[opcache.revalidate_freq]" = "1"; | ||
49 | "php_admin_value[memory_limit]" = "512M"; | ||
50 | |||
51 | "php_admin_value[open_basedir]" = "/run/wrappers/bin/sendmail:${phpBaseDir}:/proc/meminfo:/dev/urandom:/proc/self/fd:/tmp"; | ||
52 | "php_admin_value[session.save_path]" = "/var/lib/nextcloud_farm/phpSessions"; | ||
53 | }; | ||
54 | phpPackage = pkgs.php74.withExtensions({ enabled, all }: enabled ++ [ all.redis all.apcu all.opcache ]); | ||
55 | }; | ||
56 | users.users.root.packages = let | ||
57 | occ = pkgs.writeScriptBin "nextcloud-occ-bakeer" '' | ||
58 | #! ${pkgs.stdenv.shell} | ||
59 | cd ${nextcloud} | ||
60 | NEXTCLOUD_CONFIG_DIR="${varDir}" \ | ||
61 | exec \ | ||
62 | sudo -E -u wwwrun ${pkgs.php74}/bin/php \ | ||
63 | -c ${pkgs.php74}/etc/php.ini \ | ||
64 | occ $* | ||
65 | ''; | ||
66 | in [ occ ]; | ||
67 | services.websites.env.production.modules = [ "proxy_fcgi" ]; | ||
68 | services.websites.env.production.vhostConfs.bakeer = { | ||
69 | certName = "bakeer"; | ||
70 | certMainHost = "bakeer.immae.eu"; | ||
71 | addToCerts = true; | ||
72 | hosts = ["bakeer.immae.eu" "baxsolution.immae.eu"]; | ||
73 | root = nextcloud; | ||
74 | extraConfig = [ | ||
75 | '' | ||
76 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 | ||
77 | SetEnv NEXTCLOUD_CONFIG_DIR "${varDir}" | ||
78 | <Directory ${nextcloud}> | ||
79 | AcceptPathInfo On | ||
80 | DirectoryIndex index.php | ||
81 | Options FollowSymlinks | ||
82 | Require all granted | ||
83 | AllowOverride all | ||
84 | |||
85 | <IfModule mod_headers.c> | ||
86 | Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; preload" | ||
87 | </IfModule> | ||
88 | <FilesMatch "\.php$"> | ||
89 | CGIPassAuth on | ||
90 | SetHandler "proxy:unix:${config.services.phpfpm.pools.nextcloud_farm.socket}|fcgi://localhost" | ||
91 | </FilesMatch> | ||
92 | |||
93 | </Directory> | ||
94 | '' | ||
95 | ]; | ||
96 | }; | ||
97 | services.cron = { | ||
98 | enable = true; | ||
99 | systemCronJobs = let | ||
100 | script = pkgs.writeScriptBin "nextcloud-cron" '' | ||
101 | #! ${pkgs.stdenv.shell} | ||
102 | export LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive | ||
103 | export PATH=/run/wrappers/bin:$PATH | ||
104 | export NEXTCLOUD_CONFIG_DIR="${varDir}" | ||
105 | ${pkgs.php74}/bin/php -d memory_limit=512M -f ${nextcloud}/cron.php | ||
106 | ''; | ||
107 | in [ | ||
108 | '' | ||
109 | */15 * * * * wwwrun ${script}/bin/nextcloud-cron | ||
110 | '' | ||
111 | ]; | ||
112 | }; | ||
113 | }; | ||
114 | } | ||
115 | |||
diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix index ddfab9a..530db59 100644 --- a/modules/private/websites/default.nix +++ b/modules/private/websites/default.nix | |||
@@ -222,6 +222,7 @@ in | |||
222 | _theme = pkgs.webapps.apache-theme.theme; | 222 | _theme = pkgs.webapps.apache-theme.theme; |
223 | }; | 223 | }; |
224 | myServices.websites = { | 224 | myServices.websites = { |
225 | bakeer.cloud.enable = true; | ||
225 | capitaines.landing_pages.enable = true; | 226 | capitaines.landing_pages.enable = true; |
226 | 227 | ||
227 | chloe = { | 228 | chloe = { |
diff --git a/modules/private/websites/tools/cloud/default.nix b/modules/private/websites/tools/cloud/default.nix index 1a42296..8a42cad 100644 --- a/modules/private/websites/tools/cloud/default.nix +++ b/modules/private/websites/tools/cloud/default.nix | |||
@@ -140,7 +140,7 @@ in { | |||
140 | cd ${nextcloud} | 140 | cd ${nextcloud} |
141 | NEXTCLOUD_CONFIG_DIR="${nextcloud}/config" \ | 141 | NEXTCLOUD_CONFIG_DIR="${nextcloud}/config" \ |
142 | exec \ | 142 | exec \ |
143 | sudo -u wwwrun ${pkgs.php74}/bin/php \ | 143 | sudo -E -u wwwrun ${pkgs.php74}/bin/php \ |
144 | -c ${pkgs.php74}/etc/php.ini \ | 144 | -c ${pkgs.php74}/etc/php.ini \ |
145 | occ $* | 145 | occ $* |
146 | ''; | 146 | ''; |
diff --git a/nixops/secrets b/nixops/secrets | |||
Subproject 58ffafe8d341088e117ff2ea4ce7fd33d9d6bc9 | Subproject 6864a6e47101fa922e8d0bca60b9d0ca30803b2 | ||
diff --git a/pkgs/webapps/nextcloud/apps/impersonate.nix b/pkgs/webapps/nextcloud/apps/impersonate.nix new file mode 100644 index 0000000..66cc893 --- /dev/null +++ b/pkgs/webapps/nextcloud/apps/impersonate.nix | |||
@@ -0,0 +1,9 @@ | |||
1 | { buildApp, nextcloudVersion }: | ||
2 | assert nextcloudVersion >= 18 && nextcloudVersion < 19; | ||
3 | buildApp rec { | ||
4 | appName = "impersonate"; | ||
5 | version = "1.5.2"; | ||
6 | url = "https://github.com/nextcloud/impersonate/releases/download/v${version}/${appName}.tar.gz"; | ||
7 | sha256 = "03fm9d2p6ap9gyiw5anmlwsdmiyklrkpdgchfx2zfgxn38pjrz6d"; | ||
8 | } | ||
9 | |||
diff --git a/pkgs/webapps/nextcloud/default.nix b/pkgs/webapps/nextcloud/default.nix index 1df483a..5017fd2 100644 --- a/pkgs/webapps/nextcloud/default.nix +++ b/pkgs/webapps/nextcloud/default.nix | |||
@@ -3,9 +3,9 @@ let | |||
3 | appNames = [ | 3 | appNames = [ |
4 | "apporder" "audioplayer" "bookmarks" "calendar" "carnet" "circles" | 4 | "apporder" "audioplayer" "bookmarks" "calendar" "carnet" "circles" |
5 | "contacts" "cookbook" "deck" "extract" "files_markdown" | 5 | "contacts" "cookbook" "deck" "extract" "files_markdown" |
6 | "files_readmemd" "flowupload" "gpxedit" "gpxpod" "keeweb" "maps" | 6 | "files_readmemd" "flowupload" "gpxedit" "gpxpod" "impersonate" |
7 | "metadata" "music" "notes" "ocsms" "passman" "polls" "spreed" | 7 | "keeweb" "maps" "metadata" "music" "notes" "ocsms" "passman" "polls" |
8 | "social" "tasks" | 8 | "spreed" "social" "tasks" |
9 | ]; | 9 | ]; |
10 | allApps = lib.attrsets.genAttrs appNames | 10 | allApps = lib.attrsets.genAttrs appNames |
11 | (name: callPackage (./apps + "/${name}.nix") { inherit buildApp nextcloudVersion; }); | 11 | (name: callPackage (./apps + "/${name}.nix") { inherit buildApp nextcloudVersion; }); |