1 {lib, stdenv, fetchFromGitHub, git, mercurial, makeWrapper}:
3 stdenv.mkDerivation rec {
7 src = fetchFromGitHub {
11 sha256 = "sha256-re8iXM8s+TD35UGKalq2kVn8fx68fsnUC7Yo+/DQ9SM=";
14 nativeBuildInputs = [ makeWrapper ];
15 buildInputs = [mercurial.python mercurial];
19 libexecPath=$out/libexec/${pname}
20 sitepackagesPath=$out/${mercurial.python.sitePackages}
21 mkdir -p $binPath $libexecPath $sitepackagesPath
23 # Patch shell scripts so they can execute the Python scripts
24 sed -i "s|ROOT=.*|ROOT=$libexecPath|" *.sh
26 mv hg-fast-export.sh hg-reset.sh $binPath
27 mv hg-fast-export.py hg-reset.py $libexecPath
28 mv hg2git.py pluginloader plugins $sitepackagesPath
30 for script in $out/bin/*.sh; do
32 --prefix PATH : "${git}/bin":"${mercurial.python}/bin":$libexec \
33 --prefix PYTHONPATH : "${mercurial}/${mercurial.python.sitePackages}":$sitepackagesPath
37 doInstallCheck = true;
38 # deliberately not adding git or hg into nativeInstallCheckInputs - package should
39 # be able to work without them in runtime env
40 installCheckPhase = ''
43 ${mercurial}/bin/hg init
45 ${mercurial}/bin/hg add bar
46 ${mercurial}/bin/hg commit --message "baz"
52 ${git}/bin/git config core.ignoreCase false # for darwin
53 $out/bin/hg-fast-export.sh -r ../repo-hg/ --hg-hash
54 for s in "foo" "bar" "baz" ; do
55 (${git}/bin/git show | grep $s > /dev/null) && echo $s found
61 description = "Import mercurial into git";
62 homepage = "https://repo.or.cz/w/fast-export.git";
63 license = licenses.gpl2;
64 maintainers = [ maintainers.koral ];
65 platforms = platforms.unix;