From e229e6f2a411b9c03ee80bfb53b6b77e8f2ccb0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 11 Feb 2019 00:16:15 +0100 Subject: Add mpd and make adjustments --- default.nix | 2 +- nixops/eldiron.nix | 1 + nixops/modules/mpd/default.nix | 41 +++++++++++++++++++++++++ nixops/modules/websites/tools/tools/default.nix | 4 +++ nixops/modules/websites/tools/tools/ympd.json | 15 +++++++++ nixops/modules/websites/tools/tools/ympd.nix | 15 +++++++-- 6 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 nixops/modules/mpd/default.nix create mode 100644 nixops/modules/websites/tools/tools/ympd.json diff --git a/default.nix b/default.nix index 803eb84..c8a3c93 100644 --- a/default.nix +++ b/default.nix @@ -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; diff --git a/nixops/eldiron.nix b/nixops/eldiron.nix index cad4e75..a4b3f73 100644 --- a/nixops/eldiron.nix +++ b/nixops/eldiron.nix @@ -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 index 0000000..7781b36 --- /dev/null +++ b/nixops/modules/mpd/default.nix @@ -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" + } + + + ''; + }; + }; +} + diff --git a/nixops/modules/websites/tools/tools/default.nix b/nixops/modules/websites/tools/tools/default.nix index 5db7d3e..2e10a46 100644 --- a/nixops/modules/websites/tools/tools/default.nix +++ b/nixops/modules/websites/tools/tools/default.nix @@ -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 index 0000000..51f06d5 --- /dev/null +++ b/nixops/modules/websites/tools/tools/ympd.json @@ -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 + } +} diff --git a/nixops/modules/websites/tools/tools/ympd.nix b/nixops/modules/websites/tools/tools/ympd.nix index 3d0faad..613a171 100644 --- a/nixops/modules/websites/tools/tools/ympd.nix +++ b/nixops/modules/websites/tools/tools/ympd.nix @@ -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 = '' - + Use LDAPConnect Require ldap-group cn=users,cn=mpd,ou=services,dc=immae,dc=eu @@ -24,6 +27,14 @@ let ProxyPass ws://${config.webPort}/ws + + ProxyPass http://localhost:${env.mp3port}/ + ProxyPassReverse http://localhost:${env.mp3port}/ + + + ProxyPass http://localhost:${env.oggport}/ + ProxyPassReverse http://localhost:${env.oggport}/ + ''; }; }; -- cgit v1.2.3