wolf.r: add mobile mpd web frontends

This commit is contained in:
makefu 2018-09-03 00:37:13 +02:00
parent bf1747adb4
commit 481376c150
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
2 changed files with 34 additions and 1 deletions

View File

@ -25,6 +25,7 @@ in
<stockholm/krebs/2configs/shack/muell_caller.nix> <stockholm/krebs/2configs/shack/muell_caller.nix>
<stockholm/krebs/2configs/shack/radioactive.nix> <stockholm/krebs/2configs/shack/radioactive.nix>
<stockholm/krebs/2configs/shack/share.nix> <stockholm/krebs/2configs/shack/share.nix>
<stockholm/krebs/2configs/shack/mobile.mpd.nix>
{ {
systemd.services.telegraf.path = [ pkgs.net_snmp ]; # for snmptranslate systemd.services.telegraf.path = [ pkgs.net_snmp ]; # for snmptranslate
systemd.services.telegraf.environment = { systemd.services.telegraf.environment = {
@ -114,7 +115,7 @@ in
networking = { networking = {
firewall.enable = false; firewall.enable = false;
firewall.allowedTCPPorts = [ 8088 8086 8083 ]; firewall.allowedTCPPorts = [ 8088 8086 8083 ];
interfaces."${ext-if}".ip4 = [{ interfaces."${ext-if}".ipv4.addresses = [{
address = shack-ip; address = shack-ip;
prefixLength = 20; prefixLength = 20;
}]; }];

View File

@ -0,0 +1,32 @@
{lib,pkgs, ... }:
let
mpdHost = "mpd.shack";
ympd = name: port: let
webPort = 10000 + port;
in {
systemd.services."ympd-${name}" = {
description = "mpd for ${name}";
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${pkgs.ympd}/bin/ympd --host ${mpdHost} --port ${toString port} --webport ${toString webPort} --user nobody";
};
services.nginx.virtualHosts."mobile.${name}.mpd.shack" = {
serverAliases = [
"${name}.mpd.wolf.r"
"${name}.mpd.wolf.shack"
];
locations."/".proxyPass = "http://localhost:${toString webPort}";
};
};
in lib.mkMerge [{
services.nginx.enable = true;
}
(ympd "lounge" 6600)
(ympd "seminarraum" 6601)
(ympd "elab" 6602)
(ympd "kueche" 6603)
(ympd "crafting" 6604)
(ympd "fablab" 6605)
(ympd "workshop" 6606)
(ympd "klo" 6607)
]