mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 12:19:07 +00:00
hosts/ni/setups/music: add more components
Unfortunately, system-wide spotifyd doesn't work so ehh....
This commit is contained in:
parent
76e82f35ca
commit
1c432e53e6
@ -1,4 +1,4 @@
|
|||||||
{ config, lib, foodogsquaredLib, ... }:
|
{ config, lib, pkgs, foodogsquaredLib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
hostCfg = config.hosts.ni;
|
hostCfg = config.hosts.ni;
|
||||||
@ -15,10 +15,21 @@ in
|
|||||||
protocols = [ "tcp" ];
|
protocols = [ "tcp" ];
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
};
|
};
|
||||||
uxplay = {
|
spotifyd = {
|
||||||
value = 10001;
|
value = 9009;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
};
|
};
|
||||||
|
snapserver-tcp = {
|
||||||
|
value = 9080;
|
||||||
|
openFirewall = true;
|
||||||
|
};
|
||||||
|
snapserver-http = {
|
||||||
|
value = 9011;
|
||||||
|
openFirewall = true;
|
||||||
|
};
|
||||||
|
uxplay = {
|
||||||
|
value = 10001;
|
||||||
|
openFirewall = true; };
|
||||||
uxplayClients = {
|
uxplayClients = {
|
||||||
value = foodogsquaredLib.nixos.makeRange' uxplay.value 10;
|
value = foodogsquaredLib.nixos.makeRange' uxplay.value 10;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
@ -30,7 +41,7 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
settings = rec {
|
settings = rec {
|
||||||
listen-addr = "localhost:${builtins.toString config.state.ports.gonic.value}";
|
listen-addr = "localhost:${builtins.toString config.state.ports.gonic.value}";
|
||||||
cache-path = "/var/cache/gonic";
|
cache-path = "${config.state.paths.cacheDir}/gonic";
|
||||||
music-path =
|
music-path =
|
||||||
[
|
[
|
||||||
"/srv/Music"
|
"/srv/Music"
|
||||||
@ -39,19 +50,84 @@ in
|
|||||||
playlists-path = "${cache-path}/playlists";
|
playlists-path = "${cache-path}/playlists";
|
||||||
|
|
||||||
jukebox-enabled = true;
|
jukebox-enabled = true;
|
||||||
|
jukebox-mpv-extra-args = let
|
||||||
|
args = [
|
||||||
|
"--ao=pcm"
|
||||||
|
"--ao-pcm-file=${config.state.paths.runtimeDir}/snapserver/jukebox"
|
||||||
|
];
|
||||||
|
in lib.concatStringsSep " " args;
|
||||||
|
|
||||||
scan-interval = 1;
|
scan-interval = 1;
|
||||||
scan-at-start-enabled = true;
|
scan-at-start-enabled = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# My AirPlay mirroring server.
|
services.spotifyd = {
|
||||||
services.uxplay = {
|
enable = false;
|
||||||
|
settings.global = {
|
||||||
|
autoplay = true;
|
||||||
|
device_name = "My laptop";
|
||||||
|
bitrate = 320;
|
||||||
|
device_type = "computer";
|
||||||
|
use_keyring = false;
|
||||||
|
use_mpris = false;
|
||||||
|
|
||||||
|
# We're relying on the local discovery.
|
||||||
|
zeroconf_port = config.state.ports.spotifyd.value;
|
||||||
|
no_audio_cache = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.snapserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
extraArgs = [
|
http = {
|
||||||
"-p" (builtins.toString config.state.ports.uxplay.value)
|
enable = true;
|
||||||
"-reset" "30"
|
port = config.state.ports.snapserver-http.value;
|
||||||
];
|
docRoot = "${pkgs.snapcast}/share/snapserver/snapweb";
|
||||||
|
};
|
||||||
|
tcp = {
|
||||||
|
enable = true;
|
||||||
|
port = config.state.ports.snapserver-tcp.value;
|
||||||
|
};
|
||||||
|
listenAddress = "127.0.0.1";
|
||||||
|
|
||||||
|
streams = {
|
||||||
|
gonic-jukebox = {
|
||||||
|
type = "pipe";
|
||||||
|
location = "/run/snapserver/jukebox";
|
||||||
|
sampleFormat = "48000:16:2";
|
||||||
|
codec = "pcm";
|
||||||
|
};
|
||||||
|
|
||||||
|
airplay = {
|
||||||
|
type = "airplay";
|
||||||
|
location = lib.getExe' pkgs.shairport-sync "shairport-sync";
|
||||||
|
query = {
|
||||||
|
devicename = "Snapcast";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
spotify = {
|
||||||
|
type = "librespot";
|
||||||
|
location = lib.getExe' pkgs.librespot "librespot";
|
||||||
|
query = {
|
||||||
|
devicename = "Snapcast";
|
||||||
|
bitrate = "320";
|
||||||
|
volume = "50";
|
||||||
|
normalize = "true";
|
||||||
|
autoplay = "true";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.snapserver.serviceConfig = {
|
||||||
|
SupplementaryGroups = [ "audio" ];
|
||||||
|
RuntimeDirectoryMode = "0775";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.gonic.serviceConfig = {
|
||||||
|
SupplementaryGroups = [ "audio" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user