nixpkgs/pkgs/tools/misc/trackma/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

83 lines
2.4 KiB
Nix
Raw Normal View History

2022-06-30 14:35:57 +00:00
{ lib
, stdenv
, fetchFromGitHub
, python3
, wrapGAppsHook
, gobject-introspection
, glib
, gtk3
2022-07-05 16:05:20 +00:00
, qt5
, makeDesktopItem
, copyDesktopItems
2022-06-30 14:35:57 +00:00
, withCurses ? false
2022-07-05 16:05:20 +00:00
, withGTK ? false
, withQT ? false
2022-06-30 14:35:57 +00:00
}:
2022-07-05 16:05:20 +00:00
let
mkDesktopItem = name: desktopName: comment: terminal: makeDesktopItem {
inherit name desktopName comment terminal;
icon = "trackma";
exec = name + " %u";
type = "Application";
categories = [ "Network" ];
};
in
2022-06-30 14:35:57 +00:00
python3.pkgs.buildPythonApplication rec {
pname = "trackma";
version = "0.8.6";
format = "pyproject";
2022-06-30 14:35:57 +00:00
src = fetchFromGitHub {
owner = "z411";
repo = "trackma";
rev = "v${version}";
sha256 = "qlkFQSJFjxkGd5WkNGfyAo64ys8VJLep/ZOL6icXQ4c=";
2022-07-05 16:05:20 +00:00
fetchSubmodules = true; # for anime-relations submodule
2022-06-30 14:35:57 +00:00
};
nativeBuildInputs = [ copyDesktopItems python3.pkgs.poetry-core ]
++ lib.optionals withGTK [ wrapGAppsHook gobject-introspection ]
2022-07-05 16:05:20 +00:00
++ lib.optionals withQT [ qt5.wrapQtAppsHook ];
2022-06-30 14:35:57 +00:00
buildInputs = lib.optionals withGTK [ glib gtk3 ];
2022-06-30 14:35:57 +00:00
propagatedBuildInputs = with python3.pkgs; ([ requests ]
2022-07-05 16:05:20 +00:00
++ lib.optionals withQT [ pyqt5 ]
++ lib.optionals withGTK [ pycairo pygobject3 ]
2022-07-05 16:05:20 +00:00
++ lib.optionals withCurses [ urwid ]
++ lib.optionals stdenv.isLinux [ pydbus pyinotify ]
2022-07-05 16:05:20 +00:00
++ lib.optionals (withGTK || withQT) [ pillow ]);
2022-06-30 14:35:57 +00:00
2022-07-05 16:05:20 +00:00
dontWrapQtApps = true;
dontWrapGApps = true;
preFixup = lib.optional withQT "wrapQtApp $out/bin/trackma-qt"
++ lib.optional withGTK "wrapGApp $out/bin/trackma-gtk";
2022-06-30 14:35:57 +00:00
2022-07-05 16:05:20 +00:00
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
2022-06-30 14:35:57 +00:00
'';
doCheck = false;
pythonImportsCheck = [ "trackma" ];
2022-07-05 16:05:20 +00:00
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";
2022-06-30 14:35:57 +00:00
passthru.updateScript = ./update.sh;
meta = with lib; {
homepage = "https://github.com/z411/trackma";
description = "Open multi-site list manager for Unix-like systems (ex-wMAL)";
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ ];
2022-06-30 14:35:57 +00:00
};
}