From 7465b6b24c954ee8eadd55d92e03e973ee57c220 Mon Sep 17 00:00:00 2001 From: soraefir Date: Sun, 10 May 2026 11:38:19 +0200 Subject: [PATCH] script omprovement --- modules/server/containers/defs/nextcloud.nix | 91 +++++++++++++++++--- 1 file changed, 80 insertions(+), 11 deletions(-) diff --git a/modules/server/containers/defs/nextcloud.nix b/modules/server/containers/defs/nextcloud.nix index afe18ce..3139930 100644 --- a/modules/server/containers/defs/nextcloud.nix +++ b/modules/server/containers/defs/nextcloud.nix @@ -67,20 +67,89 @@ in { sleep 2 done + INSTALLED=0 #$($OCC status --output=json | grep -o '"installed":true') + if [ -z "$INSTALLED" ]; then + echo "Nextcloud not found. Running first-time setup..." + + # $OCC maintenance:install \ + # --admin-user "admin" \ + # --admin-pass "adminpassword" + + echo "Applying Settings..." + + $OCC config:system:set default_phone_region --value="CH" + $OCC config:system:set overwriteprotocol --value="https" + $OCC config:app:set core backgroundjobs_mode --value="cron" + $OCC config:system:set maintenance_window_start --type=integer --value=1 + $OCC config:system:set default_language --value="en" + $OCC config:system:set default_locale --value="en_CH" + + echo "Applying Apps..." + $OCC app:disable activity + $OCC app:disable app_api + $OCC app:disable comments + $OCC app:disable firstrunwizard + $OCC config:system:set show_first_run_wizard --type=bool --value=false + $OCC app:disable nextcloud_announcements + $OCC app:disable oauth2 + $OCC app:disable recommendations + $OCC app:disable sharebymail + $OCC app:disable support + $OCC app:disable updatenotification + $OCC app:disable user_status + + $OCC app:install calendar || true + $OCC app:install calendar || true + $OCC app:install contacts || true + $OCC app:install camerarawpreviews || true + $OCC app:install cospend || true + $OCC app:install deck || true + $OCC app:install files_markdown || true + $OCC app:install forms || true + $OCC app:install groupfolders || true + $OCC app:install ownpad || true + $OCC app:install previewgenerator || true + $OCC app:install richdocuments || true + # $OCC app:install side_menu || true + $OCC app:install spreed || true + # $OCC app:install user_saml || true + + echo "Applying Apps Settings..." + ${lib.optionalString (serverCfg.containers ? ethercalc) '' + $OCC config:app:set ownpad ownpad_ethercalc_enable --value="yes" + $OCC config:app:set ownpad ownpad_ethercalc_host --value="https:\/\/${serverCfg.containers.ethercalc.subdomain}.${serverCfg.hostDomain}" + ''} + ${lib.optionalString (serverCfg.containers ? etherpad) '' + $OCC config:app:set ownpad ownpad_etherpad_enable --value="yes" + $OCC config:app:set ownpad ownpad_etherpad_host --value="https:\/\/${serverCfg.containers.etherpad.subdomain}.${serverCfg.hostDomain}" + ''} + ${lib.optionalString (cfg.container ? collabora) '' + $OCC config:app:set richdocuments wopi_url --value="https://${serverCfg.containers.collabora.subdomain}.${serverCfg.hostDomain}/" + $OCC config:app:set richdocuments public_wopi_url --value="https://${serverCfg.containers.collabora.subdomain}.${serverCfg.hostDomain}" + ''} + # configure side_menu ... + # configure user_saml (HOW ?) + + $OCC config:system:set enabledPreviewProviders --value='["OC\\Preview\\Movie", "OC\\Preview\\PNG", "OC\\Preview\\JPEG", "OC\\Preview\\GIF", "OC\\Preview\\HEIC", "OC\\Preview\\RAW"]' --type=json + + echo "Applying Theme..." + $OCC config:app:set theming url --value="https://${containerCfg.subdomain}.${serverCfg.hostDomain}" + ${lib.optionalString (containerCfg.extra ? name) ''$OCC config:app:set theming name --value="${containerCfg.extra.name}"''} + ${lib.optionalString (containerCfg.extra ? slogan) ''$OCC config:app:set theming slogan --value="${containerCfg.extra.slogan}"''} + $OCC config:app:set theming color --value="#${config.colorScheme.palette.base0C}" + + #$OCC theming:config logo /var/www/html/data/my_logo.png + #$OCC theming:config logoheader /var/www/html/data/my_header_logo.png + #$OCC theming:config background /var/www/html/data/my_wallpaper.jpg + + else + echo "Nextcloud is already installed. Skipping setup." + fi + echo "Maintenance..." + $OCC app:update --all $OCC maintenance:repair --include-expensive --no-interaction $OCC db:add-missing-indices --no-interaction - - echo "Applying Settings..." - - $OCC config:system:set default_phone_region --value="CH" - $OCC config:system:set overwriteprotocol --value="https" - $OCC config:app:set core backgroundjobs_mode --value="cron" - $OCC config:system:set maintenance_window_start --type=integer --value=1 - - echo "Applying Apps..." - $OCC app:install calendar || true - echo "Completed Setup" '';