From 678f551246d257dec55bf5ce801849b43faccb80 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 8 Jun 2024 10:04:44 -0400 Subject: [PATCH] navidrome: configurable port --- .../containers/nixos/navidrome/default.nix | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/nixosModules/containers/nixos/navidrome/default.nix b/nixosModules/containers/nixos/navidrome/default.nix index 8600d1ce..5fb1f04b 100644 --- a/nixosModules/containers/nixos/navidrome/default.nix +++ b/nixosModules/containers/nixos/navidrome/default.nix @@ -2,6 +2,7 @@ pkgs, lib, config, + self, ... }: { options = { @@ -12,32 +13,40 @@ default = "/mnt/Media/Music"; type = lib.types.str; }; + alyraffauf.containers.nixos.navidrome.port = lib.mkOption { + description = "Port for Navidrome."; + default = 4533; + type = lib.types.int; + }; }; config = lib.mkIf config.alyraffauf.containers.nixos.navidrome.enable { containers.navidrome = { autoStart = true; bindMounts."/Music".hostPath = config.alyraffauf.containers.nixos.navidrome.musicDirectory; - config = { - config, - pkgs, - lib, - ... - }: { - system.stateVersion = "24.05"; - services.navidrome = { - enable = true; - openFirewall = true; - settings = { - Address = "0.0.0.0"; - Port = 4533; - MusicFolder = "/Music"; - DefaultTheme = "Auto"; - SubsonicArtistParticipations = true; - UIWelcomeMessage = "Welcome to Navidrome! Registrations are closed."; + config = let + port = config.alyraffauf.containers.nixos.navidrome.port; + in + { + config, + pkgs, + lib, + ... + }: { + system.stateVersion = "24.05"; + services.navidrome = { + enable = true; + openFirewall = true; + settings = { + Address = "0.0.0.0"; + Port = port; + MusicFolder = "/Music"; + DefaultTheme = "Auto"; + SubsonicArtistParticipations = true; + UIWelcomeMessage = "Welcome to Navidrome! Registrations are closed."; + }; }; }; - }; }; }; }