update media-audiobookshelf.nix

This commit is contained in:
Ingolf Wagner 2023-05-29 15:02:36 +02:00
parent d8e7484dd3
commit 31f8f1a55c
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B

View file

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