ark/hosts/wolumonde/modules/musikspider.nix

47 lines
1.1 KiB
Nix
Raw Normal View History

2023-05-08 23:09:44 +03:00
{
pkgs,
inputs,
...
2023-05-09 19:04:02 +03:00
}: let
pkg =
inputs.musikspider.packages.${pkgs.system}.musikspider.overrideAttrs
(old: {
2023-11-02 22:14:22 +03:00
LOCAL_MUSIKQUAD_SERVER = "http://127.0.0.1:5005";
2023-05-09 19:04:02 +03:00
PUBLIC_MUSIKQUAD_SERVER = "mq.gaze.systems";
PUBLIC_BASEURL = "ms.gaze.systems";
});
2023-10-13 23:14:32 +03:00
port = "4004";
2023-05-09 19:04:02 +03:00
in {
users.users.musikspider = {
isSystemUser = true;
group = "musikspider";
};
users.groups.musikspider = {};
2023-05-11 14:14:41 +03:00
systemd.services.musikspider = {
2023-05-09 19:04:02 +03:00
description = "musikspider";
wantedBy = ["multi-user.target"];
after = ["network.target"];
serviceConfig = {
User = "musikspider";
2023-10-13 23:14:32 +03:00
ExecStart = "${pkg}/bin/musikspider";
2023-05-09 19:04:02 +03:00
Restart = "on-failure";
RestartSec = 5;
WorkingDirectory = "/var/lib/musikspider";
2023-11-02 22:14:22 +03:00
Environment = "HOME=/var/lib/musikspider";
2023-05-09 19:04:02 +03:00
EnvironmentFile = pkgs.writeText "musikspider-env" ''
2023-10-13 23:14:32 +03:00
PORT=${port}
2023-05-09 19:04:02 +03:00
'';
};
};
2023-05-08 23:09:44 +03:00
services.nginx.virtualHosts."ms.gaze.systems" = {
useACMEHost = "gaze.systems";
forceSSL = true;
2023-05-09 19:04:02 +03:00
locations."/" = {
2023-10-13 23:14:32 +03:00
proxyPass = "http://localhost:${port}";
2023-05-09 19:04:02 +03:00
proxyWebsockets = true;
};
2023-05-08 23:09:44 +03:00
};
}