1
0
Fork 0

Fix various systemd configs

This commit is contained in:
Malte Brandy 2021-06-05 17:01:12 +02:00
parent 9bf0fea6f5
commit 04db7d3820
3 changed files with 29 additions and 30 deletions

View file

@ -19,28 +19,27 @@ in
{
config = {
systemd.services.${name} = {
enable = true;
wantedBy = [ "multi-user.target" ];
description = "Foundryvtt server";
preStart = ''
mkdir -p ${dataDir}
if [[ -f "${configFile}" ]]; then
tempfile=$(mktemp)
cp "${configFile}" "$tempfile"
${pkgs.jq}/bin/jq ".[0] * .[1]" -s "$tempfile" "${declarativeConfigFile}" > "${configFile}"
else
cp "${declarativeConfigFile}" "${configFile}"
fi
if [[ ! -f "${stateDir}/app/resources/app/main.js" ]]; then
echo "No ${name} app found. Please download zip from foundryvtt.com and extract to ${stateDir}/app"
fi
'';
serviceConfig = {
StateDirectory = "${name}";
WorkingDirectory = stateDir;
DynamicUser = true;
Restart = "always";
ExecStartPre = pkgs.writeShellScript "setup-foundry-vtt" ''
uid
mkdir -p ${stateDir}/app
if [[ -f "${configFile}" ]]; then
tempfile=$(mktemp)
cp "${configFile}" "$tempfile"
${pkgs.jq}/bin/jq ".[0] * .[1]" -s "$tempfile" "${declarativeConfigFile}" > "${configFile}"
else
cp "${declarativeConfigFile}" "${configFile}"
fi
if [[ ! -f "${stateDir}/app/resources/app/main.js" ]]; then
echo "No ${name} app found. Please download zip from foundryvtt.com and extract to ${stateDir}/app"
fi
'';
ExecStart = "${pkgs.nodejs}/bin/node ${stateDir}/app/resources/app/main.js --dataPath=${stateDir}/data";
ExecStart = "${pkgs.nodejs}/bin/node ${stateDir}/app/resources/app/main.js --dataPath=\"${dataDir}\"";
};
};
services = {

View file

@ -1,16 +1,17 @@
{ pkgs, ... }: {
{ pkgs, ... }:
let
serverPath = "/var/cache/gc-links/kassandra-server";
in
{
systemd.services.kassandra = {
enable = true;
wantedBy = [ "multi-user.target" ];
description = "Kassandra Server";
serviceConfig =
let serverPath = "/var/cache/gc-links/kassandra-server";
in
{
WorkingDirectory = serverPath;
ExecStart = "${serverPath}/backend -b '::1' ";
Restart = "always";
Environment = "PATH=${pkgs.coreutils}/bin/:${pkgs.taskwarrior}/bin";
User = "maralorn";
};
path = [ pkgs.coreutils pkgs.taskwarrior ];
serviceConfig = {
WorkingDirectory = serverPath;
ExecStart = "${serverPath}/backend -b '::1' ";
Restart = "always";
User = "maralorn";
};
};
}

View file

@ -90,12 +90,11 @@ in
};
environment.systemPackages = [ pkgs.laminar ];
systemd.services.laminar = {
enable = true;
wantedBy = [ "multi-user.target" ];
description = "Laminar continuous integration service";
serviceConfig = {
WorkingDirectory = stateDir;
ExecStart = "${pkgs.laminar}/bin/laminard";
DynamicUser = false;
User = "laminar";
StateDirectory = "laminar";
LimitNOFILE = "1024000";