about summary refs log tree commit diff stats
path: root/pkgs/by-name/mp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh11
-rw-r--r--pkgs/by-name/mp/mpp-beetrm/package.nix21
-rwxr-xr-xpkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh22
-rw-r--r--pkgs/by-name/mp/mpp-lyrics/package.nix26
-rwxr-xr-xpkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh18
-rw-r--r--pkgs/by-name/mp/mpp-searchadd/package.nix21
-rwxr-xr-xpkgs/by-name/mp/mpp/mpp.sh11
-rw-r--r--pkgs/by-name/mp/mpp/package.nix35
8 files changed, 115 insertions, 50 deletions
diff --git a/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh b/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh
index 3209503c..83784743 100755
--- a/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh
+++ b/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh
@@ -1,7 +1,14 @@
 #!/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>.
 
 beet remove --delete \
     title:"$(mpc --format '%title%' current)" \
diff --git a/pkgs/by-name/mp/mpp-beetrm/package.nix b/pkgs/by-name/mp/mpp-beetrm/package.nix
index 24b56606..00672838 100644
--- a/pkgs/by-name/mp/mpp-beetrm/package.nix
+++ b/pkgs/by-name/mp/mpp-beetrm/package.nix
@@ -1,15 +1,24 @@
+# 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
   mpc,
   beets,
 }:
-sysLib.writeShellScript {
+writeShellApplication {
   name = "mpp-beetrm";
-  src = ./mpp-beetrm.sh;
-  generateCompletions = false;
-  keepPath = false;
+  text = builtins.readFile ./mpp-beetrm.sh;
+  inheritPath = false;
 
-  dependencies = [
+  runtimeInputs = [
     mpc
     beets
   ];
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
diff --git a/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh b/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh
index 3fe9a6b6..d76e73b8 100755
--- a/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh
+++ b/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh
@@ -1,14 +1,18 @@
 #!/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>.
 
-tracks="$(mktmp)"
-beet list "$@" --path >"$tracks"
-
-while read -r track; do
+beet list "$@" --path | while read -r track; do
     mpc add "$track"
-done <"$tracks"
+done
 
 mpc playlist
 # vim: ft=sh
diff --git a/pkgs/by-name/mp/mpp-searchadd/package.nix b/pkgs/by-name/mp/mpp-searchadd/package.nix
index a98472d1..91ff05e9 100644
--- a/pkgs/by-name/mp/mpp-searchadd/package.nix
+++ b/pkgs/by-name/mp/mpp-searchadd/package.nix
@@ -1,15 +1,24 @@
+# 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.
   mpc,
   beets,
 }:
-sysLib.writeShellScript {
+writeShellApplication {
   name = "mpp-searchadd";
-  src = ./mpp-searchadd.sh;
-  generateCompletions = false;
-  keepPath = false;
+  text = builtins.readFile ./mpp-searchadd.sh;
+  inheritPath = false;
 
-  dependencies = [
+  runtimeInputs = [
     mpc
     beets
   ];
diff --git a/pkgs/by-name/mp/mpp/mpp.sh b/pkgs/by-name/mp/mpp/mpp.sh
index 538a56ee..1507d5cc 100755
--- a/pkgs/by-name/mp/mpp/mpp.sh
+++ b/pkgs/by-name/mp/mpp/mpp.sh
@@ -1,7 +1,14 @@
 #!/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>.
 
 case "$1" in
 "searchadd")
diff --git a/pkgs/by-name/mp/mpp/package.nix b/pkgs/by-name/mp/mpp/package.nix
index 9c5315b0..0d2f6c8d 100644
--- a/pkgs/by-name/mp/mpp/package.nix
+++ b/pkgs/by-name/mp/mpp/package.nix
@@ -1,20 +1,35 @@
+# 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,
-  mpc,
-  fd,
+  writeShellApplication,
   symlinkJoin,
   stdenv,
+  # Dependencies
+  mpc,
+  mpp-searchadd,
+  mpp-lyrics,
+  mpp-beetrm,
+  # Build dependencies
+  fd,
   zsh,
 }: let
-  script = sysLib.writeShellScript {
+  script = writeShellApplication {
     name = "mpp";
-    src = ./mpp.sh;
-    generateCompletions = false;
-    # We source the wrappers from the environment, to ensure that they have the same
-    # configurations (e.g. MPD_MUSIC_DIR in `mpc-lyrics`)
-    keepPath = true;
-    dependencies = [
+    text = builtins.readFile ./mpp.sh;
+    inheritPath = false;
+
+    runtimeInputs = [
       mpc
+      mpp-searchadd
+      mpp-lyrics
+      mpp-beetrm
     ];
   };