From e11f13779db48127a1e6d5e1376beffae2f60d65 Mon Sep 17 00:00:00 2001 From: sefidel Date: Thu, 25 Jan 2024 23:17:35 +0900 Subject: feat(modules/nextcloud): init --- modules/services/blocky/default.nix | 1 + modules/services/nextcloud.nix | 101 ++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 modules/services/nextcloud.nix (limited to 'modules') diff --git a/modules/services/blocky/default.nix b/modules/services/blocky/default.nix index 9ba4884..5afa4a8 100644 --- a/modules/services/blocky/default.nix +++ b/modules/services/blocky/default.nix @@ -34,6 +34,7 @@ in customDNS.mapping = { "metrics.internal" = "100.93.1.1"; # kanata + "nextcloud.internal" = "100.93.1.1"; # kanata }; caching = { diff --git a/modules/services/nextcloud.nix b/modules/services/nextcloud.nix new file mode 100644 index 0000000..56fcb22 --- /dev/null +++ b/modules/services/nextcloud.nix @@ -0,0 +1,101 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.services.nextcloud; +in +{ + options.modules.services.nextcloud = { + enable = mkEnableOption ""; + + secrets = { + admin-pass = mkOption { type = types.path; }; + }; + }; + + config = mkIf cfg.enable { + services.nextcloud = { + enable = true; + + package = pkgs.nextcloud28; + database.createLocally = true; + hostName = "nextcloud.internal"; + + nginx.recommendedHttpHeaders = true; + maxUploadSize = "512G"; + # https = false; + + home = "/smol/core/nextcloud"; + enableImagemagick = true; + + caching = { + apcu = true; + redis = true; + memcached = true; + }; + + configureRedis = true; + + phpOptions = { + # Fix opcache "buffer is almost full" + "opcache.interned_strings_buffer" = 16; + "opcache.jit" = 1255; + "opcache.jit_buffer_size" = "128M"; + max_execution_time = 3600; + max_input_time = 3600; + }; + + extraApps = with config.services.nextcloud.package.packages.apps; { + inherit + memories + contacts + calendar + tasks + bookmarks + deck + forms; + }; + + autoUpdateApps = { + enable = true; + startAt = "03:00"; + }; + + extraOptions = { + # Required for Logging App to function + log_type = "file"; + + enabledPreviewProviders = [ + ''OC\Preview\Image'' # alias for png,jpeg,gif,bmp + ''OC\Preview\HEIC'' + ''OC\Preview\TIFF'' + ''OC\Preview\Movie'' + ]; + + "memories.exiftool" = lib.getExe pkgs.exiftool; + "memories.ffmpeg_path" = lib.getExe' pkgs.ffmpeg-headless "ffmpeg"; + "memories.ffprobe_path" = lib.getExe' pkgs.ffmpeg-headless "ffprobe"; + "memories.vod.ffmpeg" = lib.getExe' pkgs.ffmpeg-headless "ffmpeg"; + "memories.vod.ffprobe" = lib.getExe' pkgs.ffmpeg-headless "ffprobe"; + }; + + config = { + dbtype = "pgsql"; + adminuser = "admin"; + adminpassFile = cfg.secrets.admin-pass; + }; + }; + + services.postgresqlBackup.enable = true; + environment.persistence."/persist".directories = [ + "/var/lib/postgresql" + "/var/backup/postgresql" + ]; + + systemd.services.nextcloud-cron = { + path = with pkgs; [ perl ]; + # preStart = "${pkgs.coreutils}/bin/chmod +x ${config.services.nextcloud.home}/store-apps/memories/bin-ext/*"; + }; + + }; +} -- cgit 1.4.1