about summary refs log tree commit diff
path: root/pkgs/applications/version-management/tortoisehg/default.nix
blob: e4ad91a8713feb8f137ad8601f17c9c8b1465f3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{ lib
, fetchurl
, python3Packages
, mercurial
, qt5
}:

python3Packages.buildPythonApplication rec {
  pname = "tortoisehg";
  version = "6.6.3";

  src = fetchurl {
    url = "https://www.mercurial-scm.org/release/tortoisehg/targz/tortoisehg-${version}.tar.gz";
    sha256 = "sha256-9pg1N5uj1ZaZCAm4N8toRwfVHme7nAsNMZkXSRgFves=";
  };

  nativeBuildInputs = [
    qt5.wrapQtAppsHook
  ];
  propagatedBuildInputs = with python3Packages; [
    mercurial
    # The one from python3Packages
    qscintilla-qt5
    iniparse
  ];
  buildInputs = [
    # Makes wrapQtAppsHook add these qt libraries to the wrapper search paths
    qt5.qtwayland
  ];

  # In order to spare double wrapping, we use:
  preFixup = ''
    makeWrapperArgs+=("''${qtWrapperArgs[@]}")
  '';
  # Convenient alias
  postInstall = ''
    ln -s $out/bin/thg $out/bin/tortoisehg
  '';

  # In python3Packages.buildPythonApplication doCheck is always true, and we
  # override it to not run the default unittests
  checkPhase = ''
    runHook preCheck

    $out/bin/thg version | grep -q "${version}"
    # Detect breakage of thg in case of out-of-sync mercurial update. In that
    # case any thg subcommand just opens up an gui dialog with a description of
    # version mismatch.
    echo "thg smoke test"
    $out/bin/thg -h > help.txt &
    sleep 1s
    grep -q "list of commands" help.txt

    runHook postCheck
  '';

  passthru = {
    # If at some point we'll override this argument, it might be useful to have
    # access to it here.
    inherit mercurial;
  };

  meta = {
    description = "Qt based graphical tool for working with Mercurial";
    homepage = "https://tortoisehg.bitbucket.io/";
    license = lib.licenses.gpl2Only;
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ danbst gbtb ];
  };
}