upade fileshare

This commit is contained in:
Kopatz
2024-06-02 11:57:14 +02:00
parent 28cd081419
commit 1f1562ebdf
3 changed files with 18 additions and 8 deletions

View File

@@ -15,17 +15,22 @@ in {
default = "/var/lib/file-upload";
description = "Directory to store uploaded files";
};
basePath = mkOption {
type = types.str;
default = "/";
description = "Location under which the file upload server is reachable";
};
};
};
config = mkIf cfg.enable {
users.users.kop-fileshare = {
home = cfg.dataDir;
createHome = true;
isSystemUser = true;
group = "kop-fileshare";
home = cfg.dataDir;
createHome = true;
isSystemUser = true;
group = "kop-fileshare";
};
users.groups.kop-fileshare = {};
users.groups.kop-fileshare = { };
systemd.services.kop-fileshare = {
description = "File Upload Server";
wants = [ "network-online.target" ];
@@ -35,6 +40,7 @@ in {
serviceConfig = {
ExecStart = "${pkgs.kop-fileshare}/bin/kop-fileshare";
WorkingDirectory = cfg.dataDir;
BindPaths = [ "${cfg.dataDir}" ];
User = "kop-fileshare";
Restart = "on-failure";
RestartSec = "5s";
@@ -56,6 +62,7 @@ in {
environment = {
PORT = "${toString cfg.port}";
UPLOAD_PATH = "${toString cfg.dataDir}";
BASE_PATH = "${cfg.basePath}";
};
};
};