mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
4a7f99d55d
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
58 lines
1.5 KiB
Nix
58 lines
1.5 KiB
Nix
{lib, stdenv, git, perl, ncurses, coreutils, fetchFromGitHub, makeWrapper, ...}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "diff-so-fancy";
|
|
version = "1.3.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "so-fancy";
|
|
repo = "diff-so-fancy";
|
|
rev = "v${version}";
|
|
sha256 = "0aavxahzha2mms4vdwysk79pa6wzswpfwgsq2hwaxnaf66maahfl";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
];
|
|
|
|
buildInputs = [
|
|
perl # needed for patchShebangs
|
|
];
|
|
|
|
dontBuild = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin $out/lib/diff-so-fancy
|
|
|
|
# diff-so-fancy executable searches for it's library relative to
|
|
# itself, so we are copying executable to lib, and only symlink it
|
|
# from bin/
|
|
cp diff-so-fancy $out/lib/diff-so-fancy
|
|
cp -r lib $out/lib/diff-so-fancy
|
|
ln -s $out/lib/diff-so-fancy/diff-so-fancy $out/bin
|
|
|
|
# ncurses is needed for `tput`
|
|
wrapProgram $out/lib/diff-so-fancy/diff-so-fancy \
|
|
--prefix PATH : "${git}/share/git/contrib/diff-highlight" \
|
|
--prefix PATH : "${git}/bin" \
|
|
--prefix PATH : "${coreutils}/bin" \
|
|
--prefix PATH : "${ncurses.out}/bin"
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/so-fancy/diff-so-fancy";
|
|
description = "Good-looking diffs filter for git";
|
|
license = licenses.mit;
|
|
platforms = platforms.all;
|
|
longDescription = ''
|
|
diff-so-fancy builds on the good-lookin' output of git contrib's
|
|
diff-highlight to upgrade your diffs' appearances.
|
|
'';
|
|
maintainers = with maintainers; [ fpletz globin ];
|
|
};
|
|
}
|