diff --git a/nixosModules/containers/nixos/audiobookshelf/default.nix b/nixosModules/containers/nixos/audiobookshelf/default.nix new file mode 100644 index 00000000..6e81dfd8 --- /dev/null +++ b/nixosModules/containers/nixos/audiobookshelf/default.nix @@ -0,0 +1,47 @@ +{ + pkgs, + lib, + config, + ... +}: { + options = { + alyraffauf.containers.nixos.audiobookshelf = { + enable = + lib.mkEnableOption "Enable audiobookshelf nixos container."; + mediaDirectory = lib.mkOption { + description = "Media directory for Audiobookshelf."; + default = "/mnt/Media"; + type = lib.types.str; + }; + port = lib.mkOption { + description = "Port for audiobookshelf."; + default = 13378; + type = lib.types.int; + }; + }; + }; + + config = lib.mkIf config.alyraffauf.containers.nixos.audiobookshelf.enable { + containers.audiobookshelf = { + autoStart = true; + bindMounts."/Media".hostPath = config.alyraffauf.containers.nixos.audiobookshelf.mediaDirectory; + config = let + port = config.alyraffauf.containers.nixos.audiobookshelf.port; + in + { + config, + lib, + pkgs, + ... + }: { + system.stateVersion = "24.05"; + services.audiobookshelf = { + enable = true; + openFirewall = true; + host = "0.0.0.0"; + port = port; + }; + }; + }; + }; +} diff --git a/nixosModules/containers/nixos/default.nix b/nixosModules/containers/nixos/default.nix index 7a32ccaa..8bdaf2e3 100644 --- a/nixosModules/containers/nixos/default.nix +++ b/nixosModules/containers/nixos/default.nix @@ -4,5 +4,8 @@ config, ... }: { - imports = [./navidrome]; + imports = [ + ./audiobookshelf + ./navidrome + ]; }