nixos-config/nixos/machines/chungus/media-audiobookshelf.nix

40 lines
1.2 KiB
Nix
Raw Normal View History

2023-05-28 22:52:03 +02:00
{ config, lib, pkgs, ... }:
with pkgs;
2023-05-29 15:02:36 +02:00
let
port = 8000;
group = "media";
in
2023-05-28 22:52:03 +02:00
{
2023-05-29 15:02:36 +02:00
users.users.audiobookshelf = {
isSystemUser = true;
group = group;
2023-05-28 22:52:03 +02:00
};
2023-11-08 09:26:34 +01:00
# make available in retiolum
#networking.firewall.interfaces."tinc.retiolum".allowedTCPPorts = [ port ];
#networking.firewall.interfaces."tinc.retiolum".allowedUDPPorts = [ port ];
2023-10-20 08:46:57 +02:00
networking.firewall.interfaces.enp0s31f6.allowedTCPPorts = [ port ];
networking.firewall.interfaces.enp0s31f6.allowedUDPPorts = [ port ];
2023-11-08 09:26:34 +01:00
networking.firewall.interfaces.wg0.allowedTCPPorts = [ port ];
networking.firewall.interfaces.wg0.allowedUDPPorts = [ port ];
2023-05-28 22:52:03 +02:00
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}";
2023-05-28 22:52:03 +02:00
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" ];
};
2023-05-29 15:02:36 +02:00
2023-05-28 22:52:03 +02:00
}