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"; default = "/var/lib/file-upload";
description = "Directory to store uploaded files"; 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 { config = mkIf cfg.enable {
users.users.kop-fileshare = { users.users.kop-fileshare = {
home = cfg.dataDir; home = cfg.dataDir;
createHome = true; createHome = true;
isSystemUser = true; isSystemUser = true;
group = "kop-fileshare"; group = "kop-fileshare";
}; };
users.groups.kop-fileshare = {}; users.groups.kop-fileshare = { };
systemd.services.kop-fileshare = { systemd.services.kop-fileshare = {
description = "File Upload Server"; description = "File Upload Server";
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
@@ -35,6 +40,7 @@ in {
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.kop-fileshare}/bin/kop-fileshare"; ExecStart = "${pkgs.kop-fileshare}/bin/kop-fileshare";
WorkingDirectory = cfg.dataDir; WorkingDirectory = cfg.dataDir;
BindPaths = [ "${cfg.dataDir}" ];
User = "kop-fileshare"; User = "kop-fileshare";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "5s"; RestartSec = "5s";
@@ -56,6 +62,7 @@ in {
environment = { environment = {
PORT = "${toString cfg.port}"; PORT = "${toString cfg.port}";
UPLOAD_PATH = "${toString cfg.dataDir}"; UPLOAD_PATH = "${toString cfg.dataDir}";
BASE_PATH = "${cfg.basePath}";
}; };
}; };
}; };

View File

@@ -6,7 +6,7 @@ buildGoModule rec {
src = fetchGit { src = fetchGit {
url = "git@github.com:kropatz/kop-fileshare.git"; url = "git@github.com:kropatz/kop-fileshare.git";
ref = "master"; ref = "master";
rev = "3556ccab052233c0d5d70baa631ba8b56ee8ebdb"; rev = "73456c32d3d070d457f95973403ca94bdddea95d";
}; };
vendorHash = "sha256-OQ6rNgOQHrrhE7DT+ulwpWJCDJ4DeJiDzriAu3mfS7I="; vendorHash = "sha256-OQ6rNgOQHrrhE7DT+ulwpWJCDJ4DeJiDzriAu3mfS7I=";

View File

@@ -17,7 +17,10 @@
}; };
services = { services = {
#adam-site.enable = true; #adam-site.enable = true;
kop-fileshare.enable = true; kop-fileshare = {
enable = true;
basePath = "/stash";
};
}; };
graphical = { lxqt.enable = true; }; graphical = { lxqt.enable = true; };
}; };
@@ -29,7 +32,7 @@
"localhost" = { "localhost" = {
forceSSL = false; forceSSL = false;
enableACME = false; enableACME = false;
locations."/".proxyPass = "http://127.0.0.1:7777"; locations."/stash".proxyPass = "http://127.0.0.1:7777";
}; };
}; };
}; };