nixos-config/machines/chungus/media-audiobookshelf.nix
Ingolf Wagner 7a6510a4e6
nix fmt
2024-08-29 08:26:04 +07:00

44 lines
1.2 KiB
Nix

{
config,
lib,
pkgs,
...
}:
with pkgs;
let
port = 8000;
group = "media";
in
{
users.users.audiobookshelf = {
isSystemUser = true;
group = group;
};
# make available in retiolum
#networking.firewall.interfaces."tinc.retiolum".allowedTCPPorts = [ port ];
#networking.firewall.interfaces."tinc.retiolum".allowedUDPPorts = [ port ];
networking.firewall.interfaces.enp0s31f6.allowedTCPPorts = [ port ];
networking.firewall.interfaces.enp0s31f6.allowedUDPPorts = [ port ];
networking.firewall.interfaces.wg0.allowedTCPPorts = [ port ];
networking.firewall.interfaces.wg0.allowedUDPPorts = [ port ];
systemd.services.audiobookshelf = {
enable = true;
description = "Self-hosted audiobook server for managing and playing audiobooks";
serviceConfig = {
Type = "simple";
WorkingDirectory = "/srv/audiobookshelf";
ExecStart = "${audiobookshelf}/bin/audiobookshelf --port ${toString port}";
ExecReload = "${util-linux}/bin/kill -HUP $MAINPID";
Restart = "always";
User = config.users.users.audiobookshelf.name;
Group = config.users.users.audiobookshelf.group;
};
wantedBy = [ "multi-user.target" ];
requires = [ "network.target" ];
};
}