nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 python3,
6 wrapGAppsHook3,
7 gobject-introspection,
8 glib,
9 gtk3,
10 qt5,
11 makeDesktopItem,
12 copyDesktopItems,
13 withCurses ? false,
14 withGTK ? false,
15 withQT ? false,
16}:
17let
18 mkDesktopItem =
19 name: desktopName: comment: terminal:
20 makeDesktopItem {
21 inherit
22 name
23 desktopName
24 comment
25 terminal
26 ;
27 icon = "trackma";
28 exec = name + " %u";
29 type = "Application";
30 categories = [ "Network" ];
31 };
32in
33python3.pkgs.buildPythonApplication rec {
34 pname = "trackma";
35 version = "0.9";
36 format = "pyproject";
37
38 src = fetchFromGitHub {
39 owner = "z411";
40 repo = "trackma";
41 rev = "v${version}";
42 sha256 = "Hov9qdVabu1k3SIoUmvcRtSK8TcETqGPXI2RqN/bei4=";
43 fetchSubmodules = true; # for anime-relations submodule
44 };
45
46 nativeBuildInputs = [
47 copyDesktopItems
48 python3.pkgs.poetry-core
49 ]
50 ++ lib.optionals withGTK [
51 wrapGAppsHook3
52 gobject-introspection
53 ]
54 ++ lib.optionals withQT [ qt5.wrapQtAppsHook ];
55
56 buildInputs = lib.optionals withGTK [
57 glib
58 gtk3
59 ];
60
61 propagatedBuildInputs =
62 with python3.pkgs;
63 (
64 [ requests ]
65 ++ lib.optionals withQT [ pyqt5 ]
66 ++ lib.optionals withGTK [
67 pycairo
68 pygobject3
69 ]
70 ++ lib.optionals withCurses [ urwid ]
71 ++ lib.optionals stdenv.hostPlatform.isLinux [
72 pydbus
73 pyinotify
74 ]
75 ++ lib.optionals (withGTK || withQT) [ pillow ]
76 );
77
78 dontWrapQtApps = true;
79 dontWrapGApps = true;
80
81 preFixup =
82 lib.optional withQT "wrapQtApp $out/bin/trackma-qt"
83 ++ lib.optional withGTK "wrapGApp $out/bin/trackma-gtk";
84
85 desktopItems =
86 lib.optional withQT (
87 mkDesktopItem "trackma-qt" "Trackma (Qt)" "Trackma Updater (Qt-frontend)" false
88 )
89 ++ lib.optional withGTK (
90 mkDesktopItem "trackma-gtk" "Trackma (GTK)" "Trackma Updater (Gtk-frontend)" false
91 )
92 ++ lib.optional withCurses (
93 mkDesktopItem "trackma-curses" "Trackma (ncurses)" "Trackma Updater (ncurses frontend)" true
94 );
95
96 postInstall = ''
97 install -Dvm444 $src/trackma/data/icon.png $out/share/pixmaps/trackma.png
98 '';
99
100 doCheck = false;
101
102 pythonImportsCheck = [ "trackma" ];
103
104 postDist =
105 lib.optional (!withQT) "rm $out/bin/trackma-qt"
106 ++ lib.optional (!withGTK) "rm $out/bin/trackma-gtk"
107 ++ lib.optional (!withCurses) "rm $out/bin/trackma-curses";
108
109 passthru.updateScript = ./update.sh;
110
111 meta = with lib; {
112 homepage = "https://github.com/z411/trackma";
113 description = "Open multi-site list manager for Unix-like systems (ex-wMAL)";
114 license = licenses.gpl3Plus;
115 platforms = platforms.linux;
116 maintainers = [ ];
117 };
118}