Skip to content

Commit

Permalink
Add git-cinnabar 0.5.0b3
Browse files Browse the repository at this point in the history
  • Loading branch information
nbp committed Aug 2, 2018
1 parent 64e9d5c commit cf7bc3a
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions default.nix
Expand Up @@ -12,5 +12,6 @@ with super.lib;
(import ./firefox-overlay.nix)
(import ./vidyo-overlay.nix)
(import ./servo-overlay.nix)
(import ./git-cinnabar-overlay.nix)

]) self
9 changes: 9 additions & 0 deletions git-cinnabar-overlay.nix
@@ -0,0 +1,9 @@
self: super:

{
git-cinnabar = super.callPackage ./pkgs/git-cinnabar {
# we need urllib to recognize ssh.
# python = self.pythonFull;
python = self.mercurial.python;
};
}
64 changes: 64 additions & 0 deletions pkgs/git-cinnabar/default.nix
@@ -0,0 +1,64 @@
{ stdenv, fetchFromGitHub, autoconf
, zlib
, python
, perl
, gettext
, mercurial
}:

# NOTE: git-cinnabar depends on a specific version of git-core, thus you should
# ensure that you install a git-cinnabar version which matches your git version.
#
# NOTE: This package only provides git-cinnabar tools, as a git users might want
# to have additional commands not provided by this forked version of git-core.
stdenv.mkDerivation rec {
version = "0.5.0b3";
name = "git-cinnabar-${version}";
src = fetchFromGitHub {
owner = "glandium";
repo = "git-cinnabar";
inherit name;
rev = version; # tag name
fetchSubmodules = true;
sha256 = "02fl3lzf7cnns88pkc8npr77dd7mm38h859q0fimgd21gw84xj01";
};
buildInputs = [ autoconf python gettext ];

ZLIB_PATH = zlib;
ZLIB_DEV_PATH = zlib.dev;

PERL_PATH = "${perl}/bin/perl";
NO_TCLTK = true;
V=1;

preBuild = ''
export ZLIB_PATH;
export ZLIB_DEV_PATH;
substituteInPlace git-core/Makefile --replace \
'$(ZLIB_PATH)/include' '$(ZLIB_DEV_PATH)/include'
export PERL_PATH;
export NO_TCLTK
export V;
'';

makeFlags = "prefix=\${out}";

postInstall =
let mercurial-py = mercurial + "/" + mercurial.python.sitePackages; in ''
# git-cinnabar rebuild git, we do not need that.
rm -rf $out/bin/* $out/share $out/lib
for f in $out/libexec/git-core/{git-remote-hg,git-cinnabar} ; do
substituteInPlace $f --replace \
"sys.path.append(os.path.join(os.path.dirname(__file__), 'pythonlib'))" \
"sys.path.extend(['$out/libexec/git-core/pythonlib', '${mercurial-py}'])"
mv $f $out/bin
done
mv $out/libexec/git-core/git-cinnabar-helper $out/bin/git-cinnabar-helper
mv $out/libexec/git-core/pythonlib $out/pythonlib
rm -rf $out/libexec/git-core/*
mv $out/pythonlib $out/libexec/git-core/pythonlib
substituteInPlace $out/libexec/git-core/pythonlib/cinnabar/helper.py \
--replace 'Git.config('cinnabar.helper')' "Git.config('cinnabar.helper') or '$out/bin/git-cinnabar-helper'"
'';
}

0 comments on commit cf7bc3a

Please sign in to comment.