nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python3Packages,
4 fetchFromGitLab,
5 gobject-introspection,
6 wrapGAppsHook4,
7 installShellFiles,
8 libadwaita,
9 meld,
10}:
11
12python3Packages.buildPythonApplication rec {
13 pname = "turtle";
14 version = "0.14";
15 pyproject = true;
16
17 src = fetchFromGitLab {
18 domain = "gitlab.gnome.org";
19 owner = "philippun1";
20 repo = "turtle";
21 tag = version;
22 hash = "sha256-+XDDscw5xBUp39tbZLqZWK+wsRDi401mRDjx+VR6Cu0=";
23 };
24
25 postPatch = ''
26 substituteInPlace ./install.py \
27 --replace-fail "/usr" "$out" \
28 --replace-fail "gtk-update-icon-cache" "gtk4-update-icon-cache"
29 '';
30
31 nativeBuildInputs = [
32 gobject-introspection
33 wrapGAppsHook4
34 installShellFiles
35 ];
36
37 buildInputs = [ libadwaita ];
38
39 build-system = with python3Packages; [ setuptools ];
40
41 dependencies = with python3Packages; [
42 pygobject3
43 pygit2
44 secretstorage
45 dbus-python
46 ];
47
48 postInstall = ''
49 python ./install.py install
50 installManPage data/man/*
51 '';
52
53 # Avoid wrapping two times
54 dontWrapGApps = true;
55
56 # Make sure we patch other scripts after wrapper is generated
57 # to get $program_PYTHONPATH
58 dontWrapPythonPrograms = true;
59
60 postFixup = ''
61 makeWrapperArgs+=(
62 ''${gappsWrapperArgs[@]}
63 --prefix PATH : ${lib.makeBinPath [ meld ]}
64 )
65 wrapPythonPrograms
66 ''
67 # Dialogs are not imported, but executed. The same does
68 # nautilus-python plugins. So we need to patch them as well.
69 + ''
70 for dialog_scripts in $out/lib/python*/site-packages/turtlevcs/dialogs/*.py; do
71 patchPythonScript $dialog_scripts
72 done
73 for nautilus_extensions in $out/share/nautilus-python/extensions/*.py; do
74 patchPythonScript $nautilus_extensions
75 done
76 substituteInPlace $out/share/nautilus-python/extensions/turtle_nautilus_compare.py \
77 --replace-fail 'Popen(["meld"' 'Popen(["${lib.getExe meld}"'
78 '';
79
80 meta = {
81 description = "Graphical interface for version control intended to run on gnome and nautilus";
82 homepage = "https://gitlab.gnome.org/philippun1/turtle";
83 license = lib.licenses.gpl3Plus;
84 mainProgram = "turtle_cli";
85 maintainers = with lib.maintainers; [ aleksana ];
86 platforms = lib.platforms.unix;
87 };
88}