ncps: Add support for the --cache-temp-path flag

Changed files
+19 -1
nixos
modules
services
networking
+19 -1
nixos/modules/services/networking/ncps.nix
···
"--cache-hostname='${cfg.cache.hostName}'"
"--cache-data-path='${cfg.cache.dataPath}'"
"--cache-database-url='${cfg.cache.databaseURL}'"
+
"--cache-temp-path='${cfg.cache.tempPath}'"
"--server-addr='${cfg.server.addr}'"
]
++ (lib.optional cfg.cache.allowDeleteVerb "--cache-allow-delete-verb")
···
empty to automatically generate a private/public key.
'';
};
+
+
tempPath = lib.mkOption {
+
type = lib.types.str;
+
default = "/tmp";
+
description = ''
+
The path to the temporary directory that is used by the cache to download NAR files
+
'';
+
};
};
server = {
···
};
users.groups.ncps = { };
-
systemd.services.ncps-create-datadirs = {
+
systemd.services.ncps-create-directories = {
description = "Created required directories by ncps";
serviceConfig = {
Type = "oneshot";
···
mkdir -p ${dbDir}
chown ncps:ncps ${dbDir}
fi
+
'')
+
+ (lib.optionalString (cfg.cache.tempPath != "/tmp") ''
+
if ! test -d ${cfg.cache.tempPath}; then
+
mkdir -p ${cfg.cache.tempPath}
+
chown ncps:ncps ${cfg.cache.tempPath}
+
fi
'');
wantedBy = [ "ncps.service" ];
before = [ "ncps.service" ];
···
})
(lib.mkIf (isSqlite && !lib.strings.hasPrefix "/var/lib/ncps" dbDir) {
ReadWritePaths = [ dbDir ];
+
})
+
(lib.mkIf (cfg.cache.tempPath != "/tmp") {
+
ReadWritePaths = [ cfg.cache.tempPath ];
})
# Hardening