From a6c1f6d8462c77ee9d86968069c7975f2c48955a Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sun, 28 May 2023 22:52:03 +0200 Subject: [PATCH] add media-audiobookshelf.nix --- nixos/machines/chungus/configuration.nix | 1 + .../machines/chungus/media-audiobookshelf.nix | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 nixos/machines/chungus/media-audiobookshelf.nix diff --git a/nixos/machines/chungus/configuration.nix b/nixos/machines/chungus/configuration.nix index 4919db7..8c70f2e 100644 --- a/nixos/machines/chungus/configuration.nix +++ b/nixos/machines/chungus/configuration.nix @@ -21,6 +21,7 @@ #./taskwarrior-pushover.nix ./media-share.nix + ./media-audiobookshelf.nix ./media-tdarr.nix ./media-jellyfin.nix diff --git a/nixos/machines/chungus/media-audiobookshelf.nix b/nixos/machines/chungus/media-audiobookshelf.nix new file mode 100644 index 0000000..e8c958b --- /dev/null +++ b/nixos/machines/chungus/media-audiobookshelf.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: +with pkgs; +{ + users = { + users.audiobookshelf.isSystemUser = true; + users.audiobookshelf.group = "media"; + }; + + networking.firewall.interfaces.wg0.allowedTCPPorts = [ 8000 ]; + networking.firewall.interfaces.wg0.allowedUDPPorts = [ 8000 ]; + + systemd.services.audiobookshelf = { + enable = true; + description = "Self-hosted audiobook server for managing and playing audiobooks"; + serviceConfig = { + Type = "simple"; + WorkingDirectory = "/srv/audiobookshelf"; + #ExecStart = "${unstable.audiobookshelf}/bin/audiobookshelf --host 127.0.0.1 --port 8000"; + ExecStart = "${unstable.audiobookshelf}/bin/audiobookshelf --port 8000"; + 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" ]; + }; +}