]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Add mpd and make adjustments
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 10 Feb 2019 23:16:15 +0000 (00:16 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 10 Feb 2019 23:16:15 +0000 (00:16 +0100)
default.nix
nixops/eldiron.nix
nixops/modules/mpd/default.nix [new file with mode: 0644]
nixops/modules/websites/tools/tools/default.nix
nixops/modules/websites/tools/tools/ympd.json [new file with mode: 0644]
nixops/modules/websites/tools/tools/ympd.nix

index 803eb84a599f1ca0baf9a05e55a22f4a0476c9d9..c8a3c939e4e739a6a8e217eb2e756d4f839833f1 100644 (file)
@@ -346,7 +346,7 @@ in
     inherit abook khard khal;
     inherit graphicsmagick;
     inherit youtube-dl;
-    inherit ncmpc;
+    inherit ncmpc ncmpcpp;
     inherit cadaver;
     inherit mairix notmuch;
     inherit ctags;
index cad4e7545fcfd12d3bf6ddb7b256a817951025d3..a4b3f73bd647a0171f65bb7bcb68300d33b6935e 100644 (file)
@@ -24,6 +24,7 @@
       ./modules/certificates.nix
       ./modules/gitolite
       ./modules/databases
+      ./modules/mpd
       ./modules/websites
       ./modules/mail
       ./modules/ftp
diff --git a/nixops/modules/mpd/default.nix b/nixops/modules/mpd/default.nix
new file mode 100644 (file)
index 0000000..7781b36
--- /dev/null
@@ -0,0 +1,41 @@
+{ lib, pkgs, config, myconfig, mylibs, ... }:
+{
+  config = {
+    networking.firewall.allowedTCPPorts = [ 6600 ];
+    users.users.mpd.extraGroups = [ "wwwrun" ];
+    services.mpd = {
+      enable = true;
+      network.listenAddress = "any";
+      musicDirectory = myconfig.env.mpd.folder;
+      extraConfig = ''
+        password "${myconfig.env.mpd.password}@read,add,control,admin"
+        audio_output {
+          type            "null"
+          name            "No Output"
+          mixer_type      "none"
+        }
+        audio_output {
+          type            "httpd"
+          name            "OGG"
+          encoder         "vorbis"
+          port            "${myconfig.env.ports.mpd_ogg}"
+          bind_to_address "127.0.0.1"
+          quality         "5.0"
+          format          "44100:16:1"
+        }
+        audio_output {
+          type            "httpd"
+          name            "MP3"
+          encoder         "lame"
+          port            "${myconfig.env.ports.mpd_mp3}"
+          bind_to_address "127.0.0.1"
+          quality         "5.0"
+          format          "44100:16:1"
+        }
+
+
+        '';
+    };
+  };
+}
+
index 5db7d3eb5a3e7d4127922ae49186a83fdc7fcd26..2e10a46620ff8fd4681c50c306df3ff12ac01049 100644 (file)
@@ -117,6 +117,10 @@ in {
       dokuwiki = dokuwiki.activationScript;
     };
 
+    nixpkgs.config.packageOverrides = oldpkgs: rec {
+      ympd = oldpkgs.ympd.overrideAttrs(old: mylibs.fetchedGithub ./ympd.json);
+    };
+
     systemd.services.tt-rss = {
       description = "Tiny Tiny RSS feeds update daemon";
       serviceConfig = {
diff --git a/nixops/modules/websites/tools/tools/ympd.json b/nixops/modules/websites/tools/tools/ympd.json
new file mode 100644 (file)
index 0000000..51f06d5
--- /dev/null
@@ -0,0 +1,15 @@
+{
+  "tag": "612f8fc-master",
+  "meta": {
+    "name": "ympd",
+    "url": "https://github.com/notandy/ympd",
+    "branch": "master"
+  },
+  "github": {
+    "owner": "notandy",
+    "repo": "ympd",
+    "rev": "612f8fc0b2c47fc89d403e4a044541c6b2b238c8",
+    "sha256": "01hnj10zl103mrn82vyd42fvq7w5az3jf1qz18889zv67kn73ll9",
+    "fetchSubmodules": true
+  }
+}
index 3d0faad5153782451913fe7421dc9a94465431e3..613a171c6c8275898f6a86cf479c3f888659cd8f 100644 (file)
@@ -3,14 +3,17 @@ let
   ympd = rec {
     config = {
       webPort = "localhost:${env.listenPort}";
-      mpd = env.mpd;
+      mpd = {
+        host = "${env.mpd.host} --mpdpass ${env.mpd.password}";
+        port = env.mpd.port;
+      };
     };
     apache = {
       modules = [
         "proxy_wstunnel"
         ];
       vhostConf = ''
-        <LocationMatch "^/mpd">
+        <LocationMatch "^/mpd(?!/music.(mp3|ogg))">
           Use LDAPConnect
           Require ldap-group   cn=users,cn=mpd,ou=services,dc=immae,dc=eu
         </LocationMatch>
@@ -24,6 +27,14 @@ let
         <Location "/mpd/ws">
           ProxyPass ws://${config.webPort}/ws
         </Location>
+        <Location "/mpd/music.mp3">
+          ProxyPass http://localhost:${env.mp3port}/
+          ProxyPassReverse http://localhost:${env.mp3port}/
+        </Location>
+        <Location "/mpd/music.ogg">
+          ProxyPass http://localhost:${env.oggport}/
+          ProxyPassReverse http://localhost:${env.oggport}/
+        </Location>
       '';
     };
   };