mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 12:19:07 +00:00
hosts/ni/setups/music: use state ports module
This commit is contained in:
parent
16dd14e451
commit
0e85085730
@ -1,22 +1,35 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, foodogsquaredLib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
hostCfg = config.hosts.ni;
|
hostCfg = config.hosts.ni;
|
||||||
cfg = hostCfg.setups.music;
|
cfg = hostCfg.setups.music;
|
||||||
|
|
||||||
gonicPort = 4747;
|
|
||||||
uxplayPort = gonicPort + 1;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.hosts.ni.setups.music.enable =
|
options.hosts.ni.setups.music.enable =
|
||||||
lib.mkEnableOption "music streaming and organizing setup";
|
lib.mkEnableOption "music streaming and organizing setup";
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
state.ports = rec {
|
||||||
|
gonic = {
|
||||||
|
value = 4747;
|
||||||
|
protocols = [ "tcp" ];
|
||||||
|
openFirewall = true;
|
||||||
|
};
|
||||||
|
uxplay = {
|
||||||
|
value = 10001;
|
||||||
|
openFirewall = true;
|
||||||
|
};
|
||||||
|
uxplayClients = {
|
||||||
|
value = foodogsquaredLib.nixos.makeRange' uxplay.value 10;
|
||||||
|
openFirewall = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# My portable music streaming server.
|
# My portable music streaming server.
|
||||||
services.gonic = {
|
services.gonic = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = rec {
|
settings = rec {
|
||||||
listen-addr = "localhost:${builtins.toString gonicPort}";
|
listen-addr = "localhost:${builtins.toString config.state.ports.gonic.value}";
|
||||||
cache-path = "/var/cache/gonic";
|
cache-path = "/var/cache/gonic";
|
||||||
music-path =
|
music-path =
|
||||||
[
|
[
|
||||||
@ -35,9 +48,7 @@ in
|
|||||||
# My AirPlay mirroring server.
|
# My AirPlay mirroring server.
|
||||||
services.uxplay = {
|
services.uxplay = {
|
||||||
enable = true;
|
enable = true;
|
||||||
extraArgs = [ "-p" (builtins.toString uxplayPort) ];
|
extraArgs = [ "-p" (builtins.toString config.state.ports.uxplay.value) ];
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ gonicPort uxplayPort ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user