Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / misc / gramps / default.nix
blob173afec4aa6033e907da28e758bf5699274eec4b
1 { lib, fetchFromGitHub, gtk3, pythonPackages, intltool, gexiv2,
2   pango, gobject-introspection, wrapGAppsHook, gettext,
3 # Optional packages:
4  enableOSM ? true, osm-gps-map, glib-networking,
5  enableGraphviz ? true, graphviz,
6  enableGhostscript ? true, ghostscript
7  }:
9 let
10   inherit (pythonPackages) python buildPythonApplication;
11 in buildPythonApplication rec {
12   version = "5.1.4";
13   pname = "gramps";
15   nativeBuildInputs = [ wrapGAppsHook intltool gettext gobject-introspection ];
16   buildInputs = [ gtk3 pango gexiv2 ]
17     # Map support
18     ++ lib.optionals enableOSM [ osm-gps-map glib-networking ]
19     # Graphviz support
20     ++ lib.optional enableGraphviz graphviz
21     # Ghostscript support
22     ++ lib.optional enableGhostscript ghostscript
23   ;
25   src = fetchFromGitHub {
26     owner = "gramps-project";
27     repo = "gramps";
28     rev = "v${version}";
29     sha256 = "00358nzyw686ypqv45imc5k9frcqnhla0hpx9ynna3iy6iz5006x";
30   };
32   pythonPath = with pythonPackages; [ bsddb3 pyicu pygobject3 pycairo ];
34   # Same installPhase as in buildPythonApplication but without --old-and-unmanageble
35   # install flag.
36   installPhase = ''
37     runHook preInstall
39     mkdir -p "$out/lib/${python.libPrefix}/site-packages"
41     export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
43     ${python}/bin/${python.executable} setup.py install \
44       --install-lib=$out/lib/${python.libPrefix}/site-packages \
45       --prefix="$out"
47     eapth="$out/lib/${python.libPrefix}"/site-packages/easy-install.pth
48     if [ -e "$eapth" ]; then
49         # move colliding easy_install.pth to specifically named one
50         mv "$eapth" $(dirname "$eapth")/${pname}-${version}.pth
51     fi
53     rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py*
55     runHook postInstall
56   '';
58   # https://github.com/NixOS/nixpkgs/issues/149812
59   # https://nixos.org/manual/nixpkgs/stable/#ssec-gnome-hooks-gobject-introspection
60   strictDeps = false;
62   meta = with lib; {
63     description = "Genealogy software";
64     homepage = "https://gramps-project.org";
65     license = licenses.gpl2;
66   };