about summary refs log tree commit diff stats
path: root/pkgs/by-name/mp/mpp-lyrics
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh22
-rw-r--r--pkgs/by-name/mp/mpp-lyrics/package.nix26
2 files changed, 31 insertions, 17 deletions
diff --git a/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh b/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh
index 004c67c7..e1e929b5 100755
--- a/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh
+++ b/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh
@@ -1,11 +1,21 @@
 #!/usr/bin/env dash
 
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 
-(
-    cd "%MPD_MUSIC_DIR" || die "No music dir!"
-    exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' -r | less
-)
+die() {
+    echo "Error: $1"
+    exit 1
+}
+
+cd "$XDG_MUSIC_DIR" || die "No music dir!"
+exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' --raw-output | less
 
 # vim: ft=sh
diff --git a/pkgs/by-name/mp/mpp-lyrics/package.nix b/pkgs/by-name/mp/mpp-lyrics/package.nix
index 76b590c7..0b6d8993 100644
--- a/pkgs/by-name/mp/mpp-lyrics/package.nix
+++ b/pkgs/by-name/mp/mpp-lyrics/package.nix
@@ -1,23 +1,27 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 {
-  sysLib,
+  writeShellApplication,
+  # Dependencies
   exiftool,
   mpc,
   jq,
   less,
   locale, # dependency of less
-  mpd_music_dir ? "\${XDG_MUSIC_DIR}",
 }:
-sysLib.writeShellScript {
+writeShellApplication {
   name = "mpp-lyrics";
-  src = ./mpp-lyrics.sh;
-  generateCompletions = false;
-  keepPath = false;
+  text = builtins.readFile ./mpp-lyrics.sh;
+  inheritPath = false;
 
-  replacementStrings = {
-    MPD_MUSIC_DIR = mpd_music_dir;
-  };
-
-  dependencies = [
+  runtimeInputs = [
     exiftool
     mpc
     jq