home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 59b591b7156d1a7b6d8fd9ed6d28288cf7ff821a
parent 7cd3c22d1b555d4e7385046babc58d3cc437cebc
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri, 13 Mar 2020 10:51:12 +0100

Add profiles.audio with mpd 🎵

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mmachines/wakasu.nix | 9++++++++-
Mmodules/module-list.nix | 1+
Amodules/profiles/audio.nix | 48++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/machines/wakasu.nix b/machines/wakasu.nix @@ -7,6 +7,14 @@ profiles.zsh = { enable = true; }; + profiles.audio = { + enable = true; + mpd = { + enable = true; + musicDir = "/mnt/synodine/volumeUSB2/usbshare/music"; + }; + shairport-sync = true; + }; profiles.cloud.google.enable = true; profiles.dev = { go.enable = true; @@ -40,5 +48,4 @@ gnome3.zenity # use rofi instead oathToolkit ]; - services.shairport-sync.enable = true; } diff --git a/modules/module-list.nix b/modules/module-list.nix @@ -1,5 +1,6 @@ { imports = [ + ./profiles/audio.nix ./profiles/bash.nix ./profiles/containers.nix ./profiles/desktop.nix diff --git a/modules/profiles/audio.nix b/modules/profiles/audio.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.profiles.audio; +in +{ + options = { + profiles.audio = { + enable = mkEnableOption "Enable audio profile"; + shairport-sync = mkEnableOption "Enable shairport-sync"; + mpd = { + enable = mkEnableOption "Enable mpd"; + musicDir = mkOption { + description = "Data where to find the music for mpd"; + type = types.string; + }; + }; + }; + }; + config = mkIf cfg.enable (mkMerge [ + { + services.shairport-sync.enable = cfg.shairport-sync; + } + (mkIf cfg.mpd.enable { + services.mpd = { + enable = true; + musicDirectory = cfg.mpd.musicDir; + network.listenAddress = "any"; + extraConfig = '' + audio_output { + type "pulse" + name "Local MPD" + } + ''; + }; + home.packages = with pkgs; [ + mpc_cli + ncmpcpp + ]; + }) + (mkIf (cfg.mpd.enable && config.profiles.desktop.enable) { + home.packages = with pkgs; [ + ario + ]; + }) + ]); +}