summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/shack/mobile.mpd.nix
blob: 751d233ec8b94a2f7a569e2ad1f77350efc7ee71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{lib,pkgs, ... }:
let
  pkg = lib.overrideDerivation pkgs.ympd (old: {
      patches = [ ./ympd-top-next.patch ];
  });
  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 = "${pkg}/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)

]