Try to relocated cloud data

This commit is contained in:
niten 2024-02-06 15:41:00 -08:00
parent 5a7ec9d47c
commit 19311f3519
1 changed files with 24 additions and 3 deletions

View File

@ -27,6 +27,12 @@ in {
description = "Directory at which to store server state data."; 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 { hostname = mkOption {
type = str; type = str;
description = "Hostname at which the server is available."; description = "Hostname at which the server is available.";
@ -56,6 +62,12 @@ in {
}; };
config = mkIf cfg.enable { 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}" = { fudo.secrets.host-secrets."${hostname}" = {
nextcloudAdminPasswd = { nextcloudAdminPasswd = {
source-file = source-file =
@ -131,9 +143,18 @@ in {
}; };
}; };
docker-compose.volumes = { docker-compose.volumes = {
postgres-data = { }; postgres-data = {
nextcloud-data = { }; driver = "local";
nextcloud-home = { }; 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 ]; }; in { imports = [ image ]; };