update media-audiobookshelf.nix

This commit is contained in:
Ingolf Wagner 2023-05-29 15:02:36 +02:00
parent d8e7484dd3
commit 31f8f1a55c
Signed by: palo
GPG key ID: 76BF5F1928B9618B

View file

@ -1,13 +1,17 @@
{ config, lib, pkgs, ... }:
with pkgs;
let
port = 8000;
group = "media";
in
{
users = {
users.audiobookshelf.isSystemUser = true;
users.audiobookshelf.group = "media";
users.users.audiobookshelf = {
isSystemUser = true;
group = group;
};
networking.firewall.allowedTCPPorts = [ 8000 ];
networking.firewall.allowedUDPPorts = [ 8000 ];
networking.firewall.allowedTCPPorts = [ port ];
networking.firewall.allowedUDPPorts = [ port ];
systemd.services.audiobookshelf = {
enable = true;
@ -15,7 +19,7 @@ with pkgs;
serviceConfig = {
Type = "simple";
WorkingDirectory = "/srv/audiobookshelf";
ExecStart = "${unstable.audiobookshelf}/bin/audiobookshelf --port 8000";
ExecStart = "${unstable.audiobookshelf}/bin/audiobookshelf --port ${toString port}";
ExecReload = "${util-linux}/bin/kill -HUP $MAINPID";
Restart = "always";
User = config.users.users.audiobookshelf.name;
@ -24,4 +28,5 @@ with pkgs;
wantedBy = [ "multi-user.target" ];
requires = [ "network.target" ];
};
}