disable nextcloud memories for now
This commit is contained in:
parent
a0a233c847
commit
d657cfff38
2 changed files with 99 additions and 20 deletions
|
|
@ -3,6 +3,8 @@
|
||||||
let
|
let
|
||||||
cfg = config.shb.nextcloud;
|
cfg = config.shb.nextcloud;
|
||||||
|
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
|
||||||
fqdn = "${cfg.subdomain}.${cfg.domain}";
|
fqdn = "${cfg.subdomain}.${cfg.domain}";
|
||||||
fqdnWithPort = if isNull cfg.port then fqdn else "${fqdn}:${toString cfg.port}";
|
fqdnWithPort = if isNull cfg.port then fqdn else "${fqdn}:${toString cfg.port}";
|
||||||
protocol = if !(isNull cfg.ssl) then "https" else "http";
|
protocol = if !(isNull cfg.ssl) then "https" else "http";
|
||||||
|
|
@ -662,7 +664,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf cfg.enable {
|
(mkIf cfg.enable {
|
||||||
users.users = {
|
users.users = {
|
||||||
nextcloud = {
|
nextcloud = {
|
||||||
name = "nextcloud";
|
name = "nextcloud";
|
||||||
|
|
@ -780,7 +782,7 @@ in
|
||||||
"xdebug.start_with_request" = "trigger";
|
"xdebug.start_with_request" = "trigger";
|
||||||
};
|
};
|
||||||
|
|
||||||
poolSettings = lib.mkIf (! (isNull cfg.phpFpmPoolSettings)) cfg.phpFpmPoolSettings;
|
poolSettings = mkIf (! (isNull cfg.phpFpmPoolSettings)) cfg.phpFpmPoolSettings;
|
||||||
|
|
||||||
phpExtraExtensions = all: [ all.xdebug ];
|
phpExtraExtensions = all: [ all.xdebug ];
|
||||||
};
|
};
|
||||||
|
|
@ -788,8 +790,8 @@ in
|
||||||
services.nginx.virtualHosts.${fqdn} = {
|
services.nginx.virtualHosts.${fqdn} = {
|
||||||
# listen = [ { addr = "0.0.0.0"; port = 443; } ];
|
# listen = [ { addr = "0.0.0.0"; port = 443; } ];
|
||||||
forceSSL = !(isNull cfg.ssl);
|
forceSSL = !(isNull cfg.ssl);
|
||||||
sslCertificate = lib.mkIf (!(isNull cfg.ssl)) cfg.ssl.paths.cert;
|
sslCertificate = mkIf (!(isNull cfg.ssl)) cfg.ssl.paths.cert;
|
||||||
sslCertificateKey = lib.mkIf (!(isNull cfg.ssl)) cfg.ssl.paths.key;
|
sslCertificateKey = mkIf (!(isNull cfg.ssl)) cfg.ssl.paths.key;
|
||||||
|
|
||||||
# From [1] this should fix downloading of big files. [2] seems to indicate that buffering
|
# From [1] this should fix downloading of big files. [2] seems to indicate that buffering
|
||||||
# happens at multiple places anyway, so disabling one place should be okay.
|
# happens at multiple places anyway, so disabling one place should be okay.
|
||||||
|
|
@ -805,7 +807,7 @@ in
|
||||||
pkgs.ffmpeg-headless
|
pkgs.ffmpeg-headless
|
||||||
];
|
];
|
||||||
|
|
||||||
services.postgresql.settings = lib.mkIf (! (isNull cfg.postgresSettings)) cfg.postgresSettings;
|
services.postgresql.settings = mkIf (! (isNull cfg.postgresSettings)) cfg.postgresSettings;
|
||||||
|
|
||||||
systemd.services.phpfpm-nextcloud.preStart = ''
|
systemd.services.phpfpm-nextcloud.preStart = ''
|
||||||
mkdir -p /var/log/xdebug; chown -R nextcloud: /var/log/xdebug
|
mkdir -p /var/log/xdebug; chown -R nextcloud: /var/log/xdebug
|
||||||
|
|
@ -825,7 +827,7 @@ in
|
||||||
systemd.services.nextcloud-setup.after = cfg.mountPointServices;
|
systemd.services.nextcloud-setup.after = cfg.mountPointServices;
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf cfg.phpFpmPrometheusExporter.enable {
|
(mkIf cfg.phpFpmPrometheusExporter.enable {
|
||||||
services.prometheus.exporters.php-fpm = {
|
services.prometheus.exporters.php-fpm = {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = "nginx";
|
user = "nginx";
|
||||||
|
|
@ -862,7 +864,7 @@ in
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf (cfg.enable && cfg.apps.onlyoffice.enable) {
|
(mkIf (cfg.enable && cfg.apps.onlyoffice.enable) {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = !(isNull cfg.apps.onlyoffice.jwtSecretFile);
|
assertion = !(isNull cfg.apps.onlyoffice.jwtSecretFile);
|
||||||
|
|
@ -886,8 +888,8 @@ in
|
||||||
|
|
||||||
services.nginx.virtualHosts."${cfg.apps.onlyoffice.subdomain}.${cfg.domain}" = {
|
services.nginx.virtualHosts."${cfg.apps.onlyoffice.subdomain}.${cfg.domain}" = {
|
||||||
forceSSL = !(isNull cfg.ssl);
|
forceSSL = !(isNull cfg.ssl);
|
||||||
sslCertificate = lib.mkIf (!(isNull cfg.ssl)) cfg.ssl.paths.cert;
|
sslCertificate = mkIf (!(isNull cfg.ssl)) cfg.ssl.paths.cert;
|
||||||
sslCertificateKey = lib.mkIf (!(isNull cfg.ssl)) cfg.ssl.paths.key;
|
sslCertificateKey = mkIf (!(isNull cfg.ssl)) cfg.ssl.paths.key;
|
||||||
|
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
|
@ -897,7 +899,7 @@ in
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf (cfg.enable && cfg.apps.previewgenerator.enable) {
|
(mkIf (cfg.enable && cfg.apps.previewgenerator.enable) {
|
||||||
services.nextcloud.extraApps = {
|
services.nextcloud.extraApps = {
|
||||||
inherit (nextcloudApps) previewgenerator;
|
inherit (nextcloudApps) previewgenerator;
|
||||||
};
|
};
|
||||||
|
|
@ -924,7 +926,7 @@ in
|
||||||
|
|
||||||
# Values taken from
|
# Values taken from
|
||||||
# http://web.archive.org/web/20200513043150/https://ownyourbits.com/2019/06/29/understanding-and-improving-nextcloud-previews/
|
# http://web.archive.org/web/20200513043150/https://ownyourbits.com/2019/06/29/understanding-and-improving-nextcloud-previews/
|
||||||
systemd.services.nextcloud-setup.script = lib.mkIf cfg.apps.previewgenerator.recommendedSettings ''
|
systemd.services.nextcloud-setup.script = mkIf cfg.apps.previewgenerator.recommendedSettings ''
|
||||||
${occ} config:app:set previewgenerator squareSizes --value="32 256"
|
${occ} config:app:set previewgenerator squareSizes --value="32 256"
|
||||||
${occ} config:app:set previewgenerator widthSizes --value="256 384"
|
${occ} config:app:set previewgenerator widthSizes --value="256 384"
|
||||||
${occ} config:app:set previewgenerator heightSizes --value="256"
|
${occ} config:app:set previewgenerator heightSizes --value="256"
|
||||||
|
|
@ -956,7 +958,7 @@ in
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf (cfg.enable && cfg.apps.externalStorage.enable) {
|
(mkIf (cfg.enable && cfg.apps.externalStorage.enable) {
|
||||||
systemd.services.nextcloud-setup.script = ''
|
systemd.services.nextcloud-setup.script = ''
|
||||||
${occ} app:install files_external || :
|
${occ} app:install files_external || :
|
||||||
${occ} app:enable files_external
|
${occ} app:enable files_external
|
||||||
|
|
@ -978,7 +980,7 @@ in
|
||||||
'');
|
'');
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf (cfg.enable && cfg.apps.ldap.enable) {
|
(mkIf (cfg.enable && cfg.apps.ldap.enable) {
|
||||||
systemd.services.nextcloud-setup.path = [ pkgs.jq ];
|
systemd.services.nextcloud-setup.path = [ pkgs.jq ];
|
||||||
systemd.services.nextcloud-setup.script =
|
systemd.services.nextcloud-setup.script =
|
||||||
let
|
let
|
||||||
|
|
@ -1058,7 +1060,7 @@ in
|
||||||
"email"
|
"email"
|
||||||
"groups"
|
"groups"
|
||||||
];
|
];
|
||||||
in lib.mkIf (cfg.enable && cfg.apps.sso.enable) {
|
in mkIf (cfg.enable && cfg.apps.sso.enable) {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = cfg.apps.ldap.enable;
|
assertion = cfg.apps.ldap.enable;
|
||||||
|
|
@ -1142,7 +1144,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
shb.authelia.oidcClients = lib.mkIf (cfg.apps.sso.provider == "Authelia") [
|
shb.authelia.oidcClients = mkIf (cfg.apps.sso.provider == "Authelia") [
|
||||||
{
|
{
|
||||||
client_id = cfg.apps.sso.clientID;
|
client_id = cfg.apps.sso.clientID;
|
||||||
client_name = "Nextcloud";
|
client_name = "Nextcloud";
|
||||||
|
|
@ -1156,7 +1158,7 @@ in
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf (cfg.enable && cfg.autoDisableMaintenanceModeOnStart) {
|
(mkIf (cfg.enable && cfg.autoDisableMaintenanceModeOnStart) {
|
||||||
systemd.services.nextcloud-setup.preStart =
|
systemd.services.nextcloud-setup.preStart =
|
||||||
lib.mkBefore ''
|
lib.mkBefore ''
|
||||||
if [[ -e /var/lib/nextcloud/config/config.php ]]; then
|
if [[ -e /var/lib/nextcloud/config/config.php ]]; then
|
||||||
|
|
@ -1165,7 +1167,7 @@ in
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf (cfg.enable && cfg.alwaysApplyExpensiveMigrations) {
|
(mkIf (cfg.enable && cfg.alwaysApplyExpensiveMigrations) {
|
||||||
systemd.services.nextcloud-setup.script =
|
systemd.services.nextcloud-setup.script =
|
||||||
''
|
''
|
||||||
if [[ -e /var/lib/nextcloud/config/config.php ]]; then
|
if [[ -e /var/lib/nextcloud/config/config.php ]]; then
|
||||||
|
|
@ -1176,11 +1178,18 @@ in
|
||||||
|
|
||||||
# Great source of inspiration:
|
# Great source of inspiration:
|
||||||
# https://github.com/Shawn8901/nix-configuration/blob/538c18d9ecbf7c7e649b1540c0d40881bada6690/modules/nixos/private/nextcloud/memories.nix#L226
|
# https://github.com/Shawn8901/nix-configuration/blob/538c18d9ecbf7c7e649b1540c0d40881bada6690/modules/nixos/private/nextcloud/memories.nix#L226
|
||||||
(lib.mkIf cfg.apps.memories.enable
|
(mkIf cfg.apps.memories.enable
|
||||||
(let
|
(let
|
||||||
cfg' = cfg.apps.memories;
|
cfg' = cfg.apps.memories;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = true;
|
||||||
|
message = "Memories app has an issue for now.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
services.nextcloud.extraApps = {
|
services.nextcloud.extraApps = {
|
||||||
inherit (nextcloudApps) memories;
|
inherit (nextcloudApps) memories;
|
||||||
};
|
};
|
||||||
|
|
@ -1213,13 +1222,13 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.phpfpm-nextcloud.serviceConfig = lib.mkIf cfg'.vaapi {
|
systemd.services.phpfpm-nextcloud.serviceConfig = mkIf cfg'.vaapi {
|
||||||
DeviceAllow = [ "/dev/dri/renderD128 rwm" ];
|
DeviceAllow = [ "/dev/dri/renderD128 rwm" ];
|
||||||
PrivateDevices = lib.mkForce false;
|
PrivateDevices = lib.mkForce false;
|
||||||
};
|
};
|
||||||
}))
|
}))
|
||||||
|
|
||||||
(lib.mkIf cfg.apps.recognize.enable
|
(mkIf cfg.apps.recognize.enable
|
||||||
(let
|
(let
|
||||||
cfg' = cfg.apps.recognize;
|
cfg' = cfg.apps.recognize;
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,19 @@ let
|
||||||
# This call does not block until the service is done.
|
# This call does not block until the service is done.
|
||||||
server.succeed("systemctl start nextcloud-cron.service&")
|
server.succeed("systemctl start nextcloud-cron.service&")
|
||||||
|
|
||||||
|
with subtest("setup succeeds"):
|
||||||
|
print(server.succeed("systemctl cat nextcloud-setup"))
|
||||||
|
# If the service failed, then we're not happy.
|
||||||
|
status = "active"
|
||||||
|
while status == "active":
|
||||||
|
status = server.get_unit_info("nextcloud-setup")["ActiveState"]
|
||||||
|
time.sleep(5)
|
||||||
|
if status != "inactive":
|
||||||
|
raise Exception("Setup job did not finish correctly")
|
||||||
|
|
||||||
|
if not find_in_logs("nextcloud-setup", "nextcloud-setup.service: Deactivated successfully."):
|
||||||
|
raise Exception("Nextcloud setup job did not finish successfully.")
|
||||||
|
|
||||||
with subtest("fails with incorrect authentication"):
|
with subtest("fails with incorrect authentication"):
|
||||||
client.fail(
|
client.fail(
|
||||||
"curl -f -s --location -X PROPFIND"
|
"curl -f -s --location -X PROPFIND"
|
||||||
|
|
@ -248,6 +261,27 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
memories = { config, ...}: {
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d '/srv/nextcloud' 0750 nextcloud nextcloud - -"
|
||||||
|
];
|
||||||
|
|
||||||
|
shb.nextcloud = {
|
||||||
|
apps.memories.enable = true;
|
||||||
|
apps.memories.vaapi = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
recognize = { config, ...}: {
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d '/srv/nextcloud' 0750 nextcloud nextcloud - -"
|
||||||
|
];
|
||||||
|
|
||||||
|
shb.nextcloud = {
|
||||||
|
apps.recognize.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
prometheus = { config, ... }: {
|
prometheus = { config, ... }: {
|
||||||
shb.nextcloud = {
|
shb.nextcloud = {
|
||||||
phpFpmPrometheusExporter.enable = true;
|
phpFpmPrometheusExporter.enable = true;
|
||||||
|
|
@ -352,6 +386,42 @@ in
|
||||||
testScript = commonTestScript.access;
|
testScript = commonTestScript.access;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# TODO: fix memories app
|
||||||
|
|
||||||
|
# memories = pkgs.testers.runNixOSTest {
|
||||||
|
# name = "nextcloud_memories";
|
||||||
|
|
||||||
|
# nodes.server = {
|
||||||
|
# imports = [
|
||||||
|
# basic
|
||||||
|
# testLib.certs
|
||||||
|
# https
|
||||||
|
# memories
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
|
||||||
|
# nodes.client = {};
|
||||||
|
|
||||||
|
# testScript = commonTestScript.access;
|
||||||
|
# };
|
||||||
|
|
||||||
|
recognize = pkgs.testers.runNixOSTest {
|
||||||
|
name = "nextcloud_recognize";
|
||||||
|
|
||||||
|
nodes.server = {
|
||||||
|
imports = [
|
||||||
|
basic
|
||||||
|
testLib.certs
|
||||||
|
https
|
||||||
|
recognize
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.client = {};
|
||||||
|
|
||||||
|
testScript = commonTestScript.access;
|
||||||
|
};
|
||||||
|
|
||||||
ldap = pkgs.testers.runNixOSTest {
|
ldap = pkgs.testers.runNixOSTest {
|
||||||
name = "nextcloud_ldap";
|
name = "nextcloud_ldap";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue