about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix b/nixpkgs/pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix
new file mode 100644
index 000000000000..988911d2eb7b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/version-management/git-and-tools/diff-so-fancy/default.nix
@@ -0,0 +1,48 @@
+{stdenv, git, perl, ncurses, coreutils, fetchFromGitHub, makeWrapper, ...}:
+
+stdenv.mkDerivation rec {
+  name = "diff-so-fancy-${version}";
+  version = "1.2.0";
+
+  src = fetchFromGitHub {
+    owner = "so-fancy";
+    repo = "diff-so-fancy";
+    rev = "v${version}";
+    sha256 = "0j8dxfl4js7agwdpcvxwigzpp0lik33h7s3vsjg0pd413h2j4mvz";
+  };
+
+  # Perl is needed here for patchShebangs
+  nativeBuildInputs = [ perl makeWrapper ];
+
+  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 = with stdenv.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 ];
+  };
+}