2022-08-14 13:23:50 +00:00
|
|
|
{ pkgs, invtracker, ... }:
|
|
|
|
let
|
|
|
|
port = 19689;
|
2022-08-14 18:21:46 +00:00
|
|
|
configFile = builtins.toFile "config.xml" ''
|
2022-08-14 13:23:50 +00:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<config>
|
|
|
|
<server host="127.0.0.1" port="${toString port}" />
|
2022-08-14 19:34:56 +00:00
|
|
|
<database url="jdbc:sqlite:test.db" />
|
2022-08-14 13:23:50 +00:00
|
|
|
</config>
|
|
|
|
'';
|
|
|
|
in {
|
|
|
|
systemd.services.invtracker = {
|
|
|
|
enable = true;
|
|
|
|
description = "InvTracker";
|
|
|
|
script = "${invtracker.packages.${pkgs.system}.invtracker-server}/bin/server ${configFile}";
|
|
|
|
serviceConfig = {
|
|
|
|
User = "invtracker";
|
|
|
|
Group = "invtracker";
|
|
|
|
WorkingDirectory = "/var/lib/invtracker";
|
|
|
|
Restart = "always";
|
|
|
|
};
|
|
|
|
wantedBy = ["multi-user.target"];
|
2022-08-14 19:21:27 +00:00
|
|
|
environment = {
|
|
|
|
JAVA_HOME = "${pkgs.openjdk_headless}";
|
|
|
|
};
|
2022-08-14 13:23:50 +00:00
|
|
|
};
|
|
|
|
services.nginx.virtualHosts."invtracker.chir.rs" = {
|
|
|
|
sslCertificate = "/var/lib/acme/chir.rs/cert.pem";
|
|
|
|
sslCertificateKey = "/var/lib/acme/chir.rs/key.pem";
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://localhost:${toString port}/";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
users.users.invtracker = {
|
|
|
|
description = "InvTracker";
|
|
|
|
home = "/var/lib/invtracker";
|
|
|
|
useDefaultShell = true;
|
|
|
|
group = "invtracker";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
users.groups.invtracker = {};
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d '/var/lib/invtracker' 0750 invtracker invtracker - -"
|
2022-08-15 09:17:57 +00:00
|
|
|
"d '/var/lib/invtracker/media' 0750 invtracker invtracker - -"
|
2022-08-14 13:23:50 +00:00
|
|
|
];
|
|
|
|
}
|