From e566cf24c84f84bdbf228457115709b5ea6a06f8 Mon Sep 17 00:00:00 2001 From: Tristan Druyen Date: Mon, 31 Mar 2025 12:37:40 +0200 Subject: [PATCH] Add custom aaxtomp3 pkg --- home-mods/shell/default.nix | 1 + pkgs/aaxtomp3.nix | 81 +++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 pkgs/aaxtomp3.nix diff --git a/home-mods/shell/default.nix b/home-mods/shell/default.nix index b847fa2..74a9f13 100644 --- a/home-mods/shell/default.nix +++ b/home-mods/shell/default.nix @@ -404,6 +404,7 @@ in rage nh pkgs.agenix-rekey + my.aaxtomp3 # android-studio-full ]; }; diff --git a/pkgs/aaxtomp3.nix b/pkgs/aaxtomp3.nix new file mode 100644 index 0000000..cb347f0 --- /dev/null +++ b/pkgs/aaxtomp3.nix @@ -0,0 +1,81 @@ +{ + bash, + bc, + coreutils, + fetchFromGitHub, + ffmpeg, + findutils, + gawk, + gnugrep, + gnused, + jq, + lame, + lib, + mediainfo, + mp4v2, + ncurses, + resholve, +}: + +resholve.mkDerivation rec { + pname = "aaxtomp3"; + version = "1.3"; + + src = fetchFromGitHub { + owner = "damajor"; + repo = "aaxtomp3"; + rev = "patch-1"; + hash = "sha256-e+A4PLr3/WF/KeEeS6mwpc0ybvTyXTpxoOn6Bj6ZmMg="; + }; + + postPatch = '' + substituteInPlace AAXtoMP3 \ + --replace 'AAXtoMP3' 'aaxtomp3' + substituteInPlace interactiveAAXtoMP3 \ + --replace 'AAXtoMP3' 'aaxtomp3' \ + --replace 'call="./aaxtomp3"' 'call="$AAXTOMP3"' + ''; + + installPhase = '' + install -Dm 755 AAXtoMP3 $out/bin/aaxtomp3 + install -Dm 755 interactiveAAXtoMP3 $out/bin/interactiveaaxtomp3 + ''; + + solutions.default = { + scripts = [ + "bin/aaxtomp3" + "bin/interactiveaaxtomp3" + ]; + interpreter = "${bash}/bin/bash"; + inputs = [ + bc + coreutils + ffmpeg + findutils + gawk + gnugrep + gnused + jq + lame + mediainfo + mp4v2 + ncurses + ]; + keep."$call" = true; + fix = { + "$AAXTOMP3" = [ "${placeholder "out"}/bin/aaxtomp3" ]; + "$FIND" = [ "find" ]; + "$GREP" = [ "grep" ]; + "$SED" = [ "sed" ]; + "$FFPROBE" = [ "ffprobe" ]; + "$FFMPEG" = [ "ffmpeg" ]; + }; + }; + + meta = with lib; { + description = "Convert Audible's .aax filetype to MP3, FLAC, M4A, or OPUS"; + homepage = "https://krumpetpirate.github.io/AAXtoMP3"; + license = licenses.wtfpl; + maintainers = with maintainers; [ urandom ]; + }; +}