Skip to content

Commit d6e75c4

Browse files
committed
Add cache directory to reencodarr service
1 parent 76a250a commit d6e75c4

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

nix/module.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
PORT = toString cfg.port;
1515
DATABASE_PATH = cfg.databasePath;
1616
REENCODARR_DATA_DIR = toString cfg.dataDir;
17+
REENCODARR_TMPDIR = toString cfg.cacheDir;
1718
}
1819
// cfg.extraEnvironment;
1920

@@ -138,6 +139,12 @@ in {
138139
default = "/var/lib/reencodarr";
139140
};
140141

142+
cacheDir = mkOption {
143+
type = types.path;
144+
default = "/var/cache/reencodarr";
145+
description = "Directory for temporary working files and caches.";
146+
};
147+
141148
databasePath = mkOption {
142149
type = types.str;
143150
default = "/var/lib/reencodarr/reencodarr.db";
@@ -217,6 +224,7 @@ in {
217224

218225
systemd.tmpfiles.rules = [
219226
"d ${cfg.dataDir} 0750 ${cfg.user} ${cfg.group} - -"
227+
"d ${cfg.cacheDir} 0750 ${cfg.user} ${cfg.group} - -"
220228
"d ${builtins.dirOf cfg.databasePath} 0750 ${cfg.user} ${cfg.group} - -"
221229
];
222230

@@ -239,6 +247,7 @@ in {
239247
User = cfg.user;
240248
Group = cfg.group;
241249
WorkingDirectory = cfg.dataDir;
250+
ReadWritePaths = [cfg.cacheDir cfg.dataDir (builtins.dirOf cfg.databasePath)];
242251
LoadCredential = lib.optional (cfg.secretKeyBaseFile != null) "secret_key_base:${cfg.secretKeyBaseFile}";
243252
Nice = cfg.nice;
244253
IOSchedulingClass = cfg.ioSchedulingClass;

0 commit comments

Comments
 (0)