1
0
Fork 0
This commit is contained in:
Lukas Wurzinger 2025-05-20 11:30:53 +02:00
parent e7cb8ff3f2
commit 9240071d92
No known key found for this signature in database

View file

@ -33,7 +33,7 @@ in
}; };
cacheDir = lib.mkOption { cacheDir = lib.mkOption {
default = "cache"; default = "filebrowser";
description = '' description = ''
The directory below `/var/cache` where FileBrowser stores its cache. The directory below `/var/cache` where FileBrowser stores its cache.
''; '';
@ -48,6 +48,7 @@ in
''; '';
type = types.submodule { type = types.submodule {
freeformType = format.type; freeformType = format.type;
options = { options = {
address = lib.mkOption { address = lib.mkOption {
default = "localhost"; default = "localhost";
@ -135,16 +136,21 @@ in
}; };
script = '' script = ''
mkdir --parents -- ${lib.escapeShellArgs [
cfg.settings.root
(builtins.dirOf cfg.settings.database)
]}
cd -- ${lib.escapeShellArg cfg.settings.root} cd -- ${lib.escapeShellArg cfg.settings.root}
exec ${lib.getExe cfg.package} --config ${format.generate "config.json" cfg.settings} exec ${lib.getExe cfg.package} --config ${format.generate "config.json" cfg.settings}
''; '';
}; };
tmpfiles.settings.filebrowser =
lib.genAttrs
[
cfg.settings.root
(builtins.dirOf cfg.settings.database)
]
(_: {
d.mode = "0700";
});
}; };
networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ cfg.settings.port ]; networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ cfg.settings.port ];