nixpkgs/pkgs/applications/audio/split2flac/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

63 lines
1.7 KiB
Nix

{ lib, stdenv, fetchFromGitHub, makeWrapper
, shntool, cuetools
, flac, faac, mp4v2, wavpack, mac
, imagemagick, libiconv, enca, lame, pythonPackages, vorbis-tools
, aacgain, mp3gain, vorbisgain
}:
let
wrapSplit2flac = format: ''
makeWrapper $out/bin/.split2flac-wrapped $out/bin/split2${format} \
--set SPLIT2FLAC_FORMAT ${format} \
--prefix PATH : ${stdenv.lib.makeBinPath [
shntool cuetools
flac faac mp4v2 wavpack mac
imagemagick libiconv enca lame pythonPackages.mutagen vorbis-tools
aacgain mp3gain vorbisgain
]}
'';
in stdenv.mkDerivation rec {
pname = "split2flac";
version = "122";
src = fetchFromGitHub {
owner = "ftrvxmtrx";
repo = "split2flac";
rev = version;
sha256 = "1a71amamip25hhqx7wwzfcl3d5snry9xsiha0kw73iq2m83r2k63";
};
dontBuild = true;
nativeBuildInputs = [ makeWrapper ];
patchPhase = ''
substituteInPlace split2flac \
--replace 'FORMAT="''${0##*split2}"' 'FORMAT=''${SPLIT2FLAC_FORMAT:-flac}'
'';
installPhase = ''
mkdir -p $out/share/bash-completion/completions
cp split2flac-bash-completion.sh \
$out/share/bash-completion/completions/split2flac-bash-completion.sh
mkdir -p $out/bin
cp split2flac $out/bin/.split2flac-wrapped
${wrapSplit2flac "flac"}
${wrapSplit2flac "mp3"}
${wrapSplit2flac "ogg"}
${wrapSplit2flac "m4a"}
${wrapSplit2flac "wav"}
'';
meta = with lib; {
description = "Split flac/ape/wv/wav + cue sheet into separate tracks";
homepage = "https://github.com/ftrvxmtrx/split2flac";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ jfrankenau ];
};
}