foundry: include unit

This commit is contained in:
Zynh Ludwig 2024-12-28 00:22:32 -08:00
parent bf2805b1a7
commit c6c76c488c

View file

@ -1,4 +1,4 @@
{ lib, config, ... }: { lib, config, pkgs, ... }:
let let
cfg = config.permafrost.foundry; cfg = config.permafrost.foundry;
@ -13,6 +13,32 @@ in
{ {
permafrost.nginx.enable = lib.mkDefault true; permafrost.nginx.enable = lib.mkDefault true;
} }
{
users.groups.foundry = { };
users.users.foundry = {
group = "foundry";
isSystemUser = true;
description = "foundryvtt user";
};
systemd.services.foundry =
let
mainPath = "/home/foundry/foundryvtt/resources/app/main.js";
dataPath = "/home/foundry/foundrydata";
in
{
description = "foundryvtt service";
enable = true;
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "foundry";
Restart = "always";
WorkingDirectory = "/home/foundry/foundryvtt";
ExecStart = "${lib.getExe pkgs.nodejs_20} ${mainPath} --dataPath=${dataPath}";
};
};
}
{ {
services.nginx.virtualHosts."scarlet.zynh.me" = { services.nginx.virtualHosts."scarlet.zynh.me" = {
serverName = "scarlet.zynh.me"; serverName = "scarlet.zynh.me";