diff --git a/hosts/iron/services/snapcast/mopidy.nix b/hosts/iron/services/snapcast/mopidy.nix index 18be1a5..fead046 100644 --- a/hosts/iron/services/snapcast/mopidy.nix +++ b/hosts/iron/services/snapcast/mopidy.nix @@ -1,35 +1,7 @@ { lib, pkgs, config, ... }: let interfaces = import ../../interfaces.nix; - mopidyConfig = { - audio.output = "audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/run/snapserver/mopidy.fifo"; - file.enabled = false; - local = { - library = "sqlite"; - scan_flush_threshold = 100; - media_dir = "/var/lib/music"; - included_file_extensions = lib.strings.concatStringsSep "," [ - ".aac" - ".flac" - ".m4a" - ".mp3" - ".opus" - ]; - }; - m3u = { - playlists_dir = "$XDG_CONFIG_DIR/mopidy/playlists"; - }; - http = { - enabled = true; - hostname = "::"; - port = 6680; - }; - mpd = { - enabled = true; - hostname = "::"; - port = 6600; - }; - }; + cfg = config.services.mopidy; in { services.mopidy = { @@ -43,12 +15,40 @@ in mopidy-somafm mopidy-ytmusic ]; - configuration = lib.generators.toINI { } mopidyConfig; + settings = { + audio.output = "audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/run/snapserver/mopidy.fifo"; + file.enabled = false; + local = { + library = "sqlite"; + scan_flush_threshold = 100; + media_dir = "/var/lib/music"; + included_file_extensions = lib.strings.concatStringsSep "," [ + ".aac" + ".flac" + ".m4a" + ".mp3" + ".opus" + ]; + }; + m3u = { + playlists_dir = "$XDG_CONFIG_DIR/mopidy/playlists"; + }; + http = { + enabled = true; + hostname = "::"; + port = 6680; + }; + mpd = { + enabled = true; + hostname = "::"; + port = 6600; + }; + }; }; networking.firewall.interfaces."${interfaces.lan}".allowedTCPPorts = [ - mopidyConfig.http.port - mopidyConfig.mpd.port + cfg.settings.http.port + cfg.settings.mpd.port ]; environment.systemPackages = [