From 552388f8dfd185e603b2cf8888d6ef54696bbbd5 Mon Sep 17 00:00:00 2001 From: Alexey Lebedeff Date: Fri, 17 Jun 2016 13:34:17 +0300 Subject: [PATCH] diff-so-fancy: init at 0.9.3 Script was mentioned at GitHub blog - https://github.com/blog/2188-git-2-9-has-been-released :) --- .../git-and-tools/default.nix | 2 + .../git-and-tools/diff-so-fancy/default.nix | 49 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix index 0732b0d7329f..1aafb0aa99a8 100644 --- a/pkgs/applications/version-management/git-and-tools/default.nix +++ b/pkgs/applications/version-management/git-and-tools/default.nix @@ -23,6 +23,8 @@ rec { darcsToGit = callPackage ./darcs-to-git { }; + diff-so-fancy = callPackage ./diff-so-fancy { }; + git = appendToName "minimal" gitBase; # The full-featured Git. diff --git a/pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix b/pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix new file mode 100644 index 000000000000..b29b1f90b5c3 --- /dev/null +++ b/pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix @@ -0,0 +1,49 @@ +{stdenv, git, perl, ncurses, coreutils, fetchFromGitHub, makeWrapper, ...}: + +stdenv.mkDerivation rec { + name = "diff-so-fancy-${version}"; + version = "0.9.3"; + + # perl is needed here so patchShebangs can do its job + buildInputs = [perl makeWrapper]; + + src = fetchFromGitHub { + owner = "so-fancy"; + repo = "diff-so-fancy"; + rev = "v${version}"; + sha256 = "0b5k54h3l4z81p6f7n14g2r5vz7qdyyrbql0z7rwhb7sw7s7zrgx"; + }; + + buildPhase = null; + + installPhase = '' + 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" + ''; + + meta = { + homepage = https://github.com/so-fancy/diff-so-fancy; + description = "Good-looking diffs filter for git"; + license = stdenv.lib.licenses.mit; + + longDescription = '' + diff-so-fancy builds on the good-lookin' output of git contrib's + diff-highlight to upgrade your diffs' appearances. + ''; + + platforms = stdenv.lib.platforms.all; + }; +}