trackma: fix bug with qt option

This commit is contained in:
WeebSorceress 2022-07-05 13:05:20 -03:00
parent eced91d2f8
commit ad36639f47
No known key found for this signature in database
GPG Key ID: 8E1DE45BD51CC084
2 changed files with 42 additions and 18 deletions

View File

@ -6,10 +6,22 @@
, gobject-introspection
, glib
, gtk3
, qt5
, makeDesktopItem
, copyDesktopItems
, withCurses ? false
, withGtk ? false
, withGTK ? false
, withQT ? false
}:
let
mkDesktopItem = name: desktopName: comment: terminal: makeDesktopItem {
inherit name desktopName comment terminal;
icon = "trackma";
exec = name + " %u";
type = "Application";
categories = [ "Network" ];
};
in
python3.pkgs.buildPythonApplication rec {
pname = "trackma";
version = "0.8.4";
@ -19,36 +31,46 @@ python3.pkgs.buildPythonApplication rec {
repo = "trackma";
rev = "v${version}";
sha256 = "sha256-drc39ID4WYBQ/L2py57CB5OkQNfRKNigPQW0Lp8GIMc=";
fetchSubmodules = true; # for anime-relations submodule
};
nativeBuildInputs = lib.optionals withGtk [ wrapGAppsHook ];
nativeBuildInputs = [ copyDesktopItems ]
++ lib.optionals withGTK [ wrapGAppsHook ]
++ lib.optionals withQT [ qt5.wrapQtAppsHook ];
buildInputs = lib.optionals withGtk [ glib gobject-introspection gtk3 ];
buildInputs = lib.optionals withGTK [ glib gobject-introspection gtk3 ];
propagatedBuildInputs = [ python3.pkgs.urllib3 python3.pkgs.dbus-python ]
++ lib.optionals withGtk [ python3.pkgs.pillow python3.pkgs.pygobject3 python3.pkgs.pycairo ]
++ lib.optionals withCurses [ python3.pkgs.urwid ]
++ lib.optionals stdenv.isLinux [ python3.pkgs.pyinotify ];
propagatedBuildInputs = with python3.pkgs; ([ urllib3 ]
++ lib.optionals withQT [ pyqt5 ]
++ lib.optionals withGTK [ pycairo ]
++ lib.optionals withCurses [ urwid ]
++ lib.optionals stdenv.isLinux [ dbus-python pygobject3 pyinotify ]
++ lib.optionals (withGTK || withQT) [ pillow ]);
# broken with gobject-introspection setup hook, see https://github.com/NixOS/nixpkgs/issues/56943
strictDeps = false;
dontWrapGApps = true; # prevent double wrapping
dontWrapQtApps = true;
dontWrapGApps = true;
preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
preFixup = lib.optional withQT "wrapQtApp $out/bin/trackma-qt"
++ lib.optional withGTK "wrapGApp $out/bin/trackma-gtk";
desktopItems = lib.optional withQT (mkDesktopItem "trackma-qt" "Trackma (Qt)" "Trackma Updater (Qt-frontend)" false)
++ lib.optional withGTK (mkDesktopItem "trackma-gtk" "Trackma (GTK)" "Trackma Updater (Gtk-frontend)" false)
++ lib.optional withCurses (mkDesktopItem "trackma-curses" "Trackma (ncurses)" "Trackma Updater (ncurses frontend)" true);
postInstall = ''
install -Dvm444 $src/trackma/data/icon.png $out/share/pixmaps/trackma.png
'';
doCheck = false;
pythonImportsCheck = [ "trackma" ];
# FIXME(trackma-qt): https://github.com/NixOS/nixpkgs/pull/179715#issuecomment-1171371059
postDist = ''
rm $out/bin/trackma-qt
${lib.optionalString (!withGtk) "rm $out/bin/trackma-gtk"}
${lib.optionalString (!withCurses) "rm $out/bin/trackma-curses"}
'';
postDist = lib.optional (!withQT) "rm $out/bin/trackma-qt"
++ lib.optional (!withGTK) "rm $out/bin/trackma-gtk"
++ lib.optional (!withCurses) "rm $out/bin/trackma-curses";
passthru.updateScript = ./update.sh;

View File

@ -11214,7 +11214,9 @@ with pkgs;
trackma-curses = trackma.override { withCurses = true; };
trackma-gtk = trackma.override { withGtk = true; };
trackma-gtk = trackma.override { withGTK = true; };
trackma-qt = trackma.override { withQT = true; };
tpmmanager = libsForQt5.callPackage ../applications/misc/tpmmanager { };