diff options
author | sefidel <contact@sefidel.net> | 2024-01-25 23:17:35 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2024-01-25 23:17:35 +0900 |
commit | e11f13779db48127a1e6d5e1376beffae2f60d65 (patch) | |
tree | 37d085aff99651028f2d84e2ad0f18fcd8722e4f | |
parent | b153f77cb5c236d6da43fbadaebe5603b3b59b81 (diff) | |
download | nixrc-e11f13779db48127a1e6d5e1376beffae2f60d65.tar.gz nixrc-e11f13779db48127a1e6d5e1376beffae2f60d65.zip |
feat(modules/nextcloud): init
-rw-r--r-- | modules/services/blocky/default.nix | 1 | ||||
-rw-r--r-- | modules/services/nextcloud.nix | 101 |
2 files changed, 102 insertions, 0 deletions
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/*"; + }; + + }; +} |