about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--modules/home/pkgs/default.nix5
-rwxr-xr-xpkgs/by-name/ly/lyrics/lyrics.sh2
-rw-r--r--pkgs/by-name/ly/lyrics/package.nix6
3 files changed, 11 insertions, 2 deletions
diff --git a/modules/home/pkgs/default.nix b/modules/home/pkgs/default.nix
index 81bb362d..eb958a18 100644
--- a/modules/home/pkgs/default.nix
+++ b/modules/home/pkgs/default.nix
@@ -138,7 +138,10 @@ with pkgs; let
         mpc # Wrapper around `mpc` that allows the usage of `mpc-{rm,fav}` without the `-`
         mpc-rm # Removes the currently playing song from the playlist
         mpc-fav # Adds the currently playing song to the favorites
-        lyrics # Displays the lyrics of the currently playing song
+        # Displays the lyrics of the currently playing song
+        (lyrics.override {
+          mpd_music_dir = config.services.mpd.musicDirectory;
+        })
         sort_song # Sorts songs in the current directory.
       ];
     };
diff --git a/pkgs/by-name/ly/lyrics/lyrics.sh b/pkgs/by-name/ly/lyrics/lyrics.sh
index 02a147c8..004c67c7 100755
--- a/pkgs/by-name/ly/lyrics/lyrics.sh
+++ b/pkgs/by-name/ly/lyrics/lyrics.sh
@@ -4,7 +4,7 @@
 SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
 
 (
-    cd "$XDG_MUSIC_DIR" || die "No music dir!"
+    cd "%MPD_MUSIC_DIR" || die "No music dir!"
     exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' -r | less
 )
 
diff --git a/pkgs/by-name/ly/lyrics/package.nix b/pkgs/by-name/ly/lyrics/package.nix
index 041eed96..d83057ce 100644
--- a/pkgs/by-name/ly/lyrics/package.nix
+++ b/pkgs/by-name/ly/lyrics/package.nix
@@ -5,12 +5,18 @@
   jq,
   less,
   locale, # dependency of less
+  mpd_music_dir ? "\${XDG_MUSIC_DIR}",
 }:
 sysLib.writeShellScript {
   name = "lyrics";
   src = ./lyrics.sh;
   generateCompletions = false;
   keepPath = false;
+
+  replacementStrings = {
+    MPD_MUSIC_DIR = mpd_music_dir;
+  };
+
   dependencies = [
     exiftool
     mpc-cli