From 9564df4acb4b0dbd52c2691af6e7004e2e9fd6f6 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 21 Mar 2024 20:30:25 +0100 Subject: [PATCH 1/5] nixos: services: podgrab: use 'media' group --- modules/nixos/services/podgrab/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/nixos/services/podgrab/default.nix b/modules/nixos/services/podgrab/default.nix index 5ceebb6..f1a8eb2 100644 --- a/modules/nixos/services/podgrab/default.nix +++ b/modules/nixos/services/podgrab/default.nix @@ -29,8 +29,13 @@ in services.podgrab = { enable = true; inherit (cfg) passwordFile port; + + group = "media"; }; + # Set-up media group + users.groups.media = { }; + my.services.nginx.virtualHosts = { podgrab = { inherit (cfg) port; From 408ae6bffd06b236045e3f7856b88284892bfc4c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 21 Mar 2024 20:30:25 +0100 Subject: [PATCH 2/5] nixos: services: podgrab: add 'dataDir' --- modules/nixos/services/podgrab/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/nixos/services/podgrab/default.nix b/modules/nixos/services/podgrab/default.nix index f1a8eb2..ce52ec3 100644 --- a/modules/nixos/services/podgrab/default.nix +++ b/modules/nixos/services/podgrab/default.nix @@ -17,6 +17,15 @@ in ''; }; + dataDir = mkOption { + type = with types; nullOr str; + default = null; + example = "/mnt/paperless"; + description = '' + Path to the directory to store the podcasts. Use default if null + ''; + }; + port = mkOption { type = types.port; default = 8080; @@ -31,6 +40,7 @@ in inherit (cfg) passwordFile port; group = "media"; + dataDirectory = lib.mkIf (cfg.dataDir != null) cfg.dataDir; }; # Set-up media group From 135dd86d7e6246087c5bd6b1ed3f8053ed6896e8 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 21 Mar 2024 20:32:05 +0100 Subject: [PATCH 3/5] hosts: nixos: porthos: migrate podgrab 'dataDir' I want to share it with `audiobookshelf`, so putting it in `/data/media` makes it easier. --- hosts/nixos/porthos/services.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/nixos/porthos/services.nix b/hosts/nixos/porthos/services.nix index a67ae3b..d84c2fa 100644 --- a/hosts/nixos/porthos/services.nix +++ b/hosts/nixos/porthos/services.nix @@ -134,6 +134,7 @@ in podgrab = { enable = true; passwordFile = secrets."podgrab/password".path; + dataDir = "/data/media/podcasts"; port = 9598; }; # Regular backups From fc33906fa085cd989bea8b97414178eba95769ff Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 21 Mar 2024 19:59:34 +0100 Subject: [PATCH 4/5] nixos: services: add audiobookshelf --- .../nixos/services/audiobookshelf/default.nix | 39 +++++++++++++++++++ modules/nixos/services/default.nix | 1 + 2 files changed, 40 insertions(+) create mode 100644 modules/nixos/services/audiobookshelf/default.nix diff --git a/modules/nixos/services/audiobookshelf/default.nix b/modules/nixos/services/audiobookshelf/default.nix new file mode 100644 index 0000000..8c9719d --- /dev/null +++ b/modules/nixos/services/audiobookshelf/default.nix @@ -0,0 +1,39 @@ +# Audiobook and podcast library +{ config, lib, ... }: +let + cfg = config.my.services.audiobookshelf; +in +{ + options.my.services.audiobookshelf = with lib; { + enable = mkEnableOption "Audiobookshelf, a self-hosted podcast manager"; + + port = mkOption { + type = types.port; + default = 8000; + example = 4242; + description = "The port on which Audiobookshelf will listen for incoming HTTP traffic."; + }; + }; + + config = lib.mkIf cfg.enable { + services.audiobookshelf = { + enable = true; + inherit (cfg) port; + + group = "media"; + }; + + # Set-up media group + users.groups.media = { }; + + my.services.nginx.virtualHosts = { + audiobookshelf = { + inherit (cfg) port; + # Proxy websockets for RPC + extraConfig = { + locations."/".proxyWebsockets = true; + }; + }; + }; + }; +} diff --git a/modules/nixos/services/default.nix b/modules/nixos/services/default.nix index 3b32d06..60b2478 100644 --- a/modules/nixos/services/default.nix +++ b/modules/nixos/services/default.nix @@ -4,6 +4,7 @@ imports = [ ./adblock ./aria + ./audiobookshelf ./backup ./blog ./calibre-web From d83384e6bba385489b2d3a314b74c9bcae5d9e95 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 21 Mar 2024 20:00:17 +0100 Subject: [PATCH 5/5] hosts: nixos: porthos: services: audiobookshelf --- hosts/nixos/porthos/services.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hosts/nixos/porthos/services.nix b/hosts/nixos/porthos/services.nix index d84c2fa..23901f7 100644 --- a/hosts/nixos/porthos/services.nix +++ b/hosts/nixos/porthos/services.nix @@ -10,6 +10,11 @@ in adblock = { enable = true; }; + # Audiobook and podcast library + audiobookshelf = { + enable = true; + port = 9599; + }; # Backblaze B2 backup backup = { enable = true;