REWRITE
This commit is contained in:
+30
-40
@@ -63,6 +63,22 @@ in
|
||||
default = "ext4";
|
||||
description = "Filesystem type of the external drive.";
|
||||
};
|
||||
|
||||
extraDirs = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.submodule {
|
||||
options = {
|
||||
path = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Path relative to mountPoint (e.g. \"gitea/data\").";
|
||||
};
|
||||
mode = lib.mkOption { type = lib.types.str; default = "0750"; };
|
||||
user = lib.mkOption { type = lib.types.str; default = "root"; };
|
||||
group = lib.mkOption { type = lib.types.str; default = "root"; };
|
||||
};
|
||||
});
|
||||
default = [];
|
||||
description = "Per-service directories to create under mountPoint. Each service module contributes its own entries.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg.device != "") {
|
||||
@@ -79,46 +95,20 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
# Ensure the mount point directory exists
|
||||
# Mount point root + shared infrastructure dirs (restic cache, shared media).
|
||||
# Per-service dirs are contributed via homey.storage.extraDirs by each
|
||||
# service module, so adding a new service only requires editing that module.
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${cfg.mountPoint} 0755 root root -"
|
||||
|
||||
# Service subdirectories — created on boot so containers can start
|
||||
# even before any data is restored into them.
|
||||
"d ${cfg.mountPoint}/openldap 0750 root root -"
|
||||
"d ${cfg.mountPoint}/openldap/etc-ldap-slapd.d 0750 root root -"
|
||||
"d ${cfg.mountPoint}/openldap/var-lib-ldap 0750 root root -"
|
||||
"d ${cfg.mountPoint}/authelia 0750 root root -"
|
||||
"d ${cfg.mountPoint}/authelia/config 0750 root root -"
|
||||
"d ${cfg.mountPoint}/gitea 0750 1000 1000 -"
|
||||
"d ${cfg.mountPoint}/gitea/data 0750 1000 1000 -"
|
||||
"d ${cfg.mountPoint}/nextcloud 0750 root root -"
|
||||
# www-data in the Nextcloud container is UID 33; it needs rx on the
|
||||
# directory and rw on all files it creates inside.
|
||||
"d ${cfg.mountPoint}/nextcloud/html 0750 33 33 -"
|
||||
# Postgres (uid 999) must own this directory — it creates files directly in it
|
||||
"d ${cfg.mountPoint}/nextcloud/db 0700 999 999 -"
|
||||
"d ${cfg.mountPoint}/jellyfin 0750 root root -"
|
||||
"d ${cfg.mountPoint}/jellyfin/config 0750 root root -"
|
||||
"d ${cfg.mountPoint}/media 0755 root root -"
|
||||
"d ${cfg.mountPoint}/media/movies 0755 root root -"
|
||||
"d ${cfg.mountPoint}/media/tvshows 0755 root root -"
|
||||
"d ${cfg.mountPoint}/media/general 0755 root root -"
|
||||
"d ${cfg.mountPoint}/media/complete 0755 root root -"
|
||||
"d ${cfg.mountPoint}/transmission 0750 root root -"
|
||||
"d ${cfg.mountPoint}/transmission/config 0750 root root -"
|
||||
"d ${cfg.mountPoint}/uptime-kuma 0750 root root -"
|
||||
"d ${cfg.mountPoint}/ntfy 0750 ntfy-sh ntfy-sh -"
|
||||
"d ${cfg.mountPoint}/ntfy/attachments 0750 ntfy-sh ntfy-sh -"
|
||||
"d ${cfg.mountPoint}/paperless 0750 root root -"
|
||||
# Paperless runs as UID 1000 (configured via USERMAP_UID)
|
||||
"d ${cfg.mountPoint}/paperless/data 0750 1000 1000 -"
|
||||
"d ${cfg.mountPoint}/paperless/media 0750 1000 1000 -"
|
||||
"d ${cfg.mountPoint}/paperless/consume 0750 1000 1000 -"
|
||||
"d ${cfg.mountPoint}/paperless/export 0750 1000 1000 -"
|
||||
"d ${cfg.mountPoint}/mealie 0750 root root -"
|
||||
"d ${cfg.mountPoint}/mealie/data 0755 root root -"
|
||||
"d ${cfg.mountPoint}/restic-cache 0700 root root -"
|
||||
];
|
||||
"d ${cfg.mountPoint} 0755 root root -"
|
||||
# Shared media directories used by both Jellyfin and Transmission.
|
||||
"d ${cfg.mountPoint}/media 0755 root root -"
|
||||
"d ${cfg.mountPoint}/media/movies 0755 root root -"
|
||||
"d ${cfg.mountPoint}/media/tvshows 0755 root root -"
|
||||
"d ${cfg.mountPoint}/media/general 0755 root root -"
|
||||
"d ${cfg.mountPoint}/media/complete 0755 root root -"
|
||||
"d ${cfg.mountPoint}/restic-cache 0700 root root -"
|
||||
] ++ (map
|
||||
(d: "d ${cfg.mountPoint}/${d.path} ${d.mode} ${d.user} ${d.group} -")
|
||||
config.homey.storage.extraDirs);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user