From 19311f351978804e80fd0023d0880e8892dd322d Mon Sep 17 00:00:00 2001 From: niten Date: Tue, 6 Feb 2024 15:41:00 -0800 Subject: [PATCH] Try to relocated cloud data --- nextcloud-container.nix | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/nextcloud-container.nix b/nextcloud-container.nix index b6c39c9..02af502 100644 --- a/nextcloud-container.nix +++ b/nextcloud-container.nix @@ -27,6 +27,12 @@ in { description = "Directory at which to store server state data."; }; + store-directory = mkOption { + type = str; + description = + "Directory at which to store bulk cloud data (eg pictures)."; + }; + hostname = mkOption { type = str; description = "Hostname at which the server is available."; @@ -56,6 +62,12 @@ in { }; config = mkIf cfg.enable { + systemd.tmpfiles.rules = [ + "d ${cfg.state-directory}/nextcloud 0750 root root - -" + "d ${cfg.state-directory}/postgres 0750 root root - -" + "d ${cfg.store-directory} 0750 root root - -" + ]; + fudo.secrets.host-secrets."${hostname}" = { nextcloudAdminPasswd = { source-file = @@ -131,9 +143,18 @@ in { }; }; docker-compose.volumes = { - postgres-data = { }; - nextcloud-data = { }; - nextcloud-home = { }; + postgres-data = { + driver = "local"; + driver_opts.device = "${cfg.state-directory}/postgresql"; + }; + nextcloud-data = { + driver = "local"; + driver_opts.device = cfg.store-directory; + }; + nextcloud-home = { + driver = "local"; + driver_opts.device = "${cfg.state-directory}/nextcloud"; + }; }; }; in { imports = [ image ]; };