python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / games / grapejuice / default.nix
blobf58596fccc129da100bb4758a712ce46f1c16f0c
1 { lib
2 , fetchFromGitLab
3 , gobject-introspection
4 , pciutils
5 , python3Packages
6 , gtk3
7 , wrapGAppsHook
8 , glib
9 , cairo
10 , desktop-file-utils
11 , xdg-utils
12 , xdg-user-dirs
13 , gettext
14 , winetricks
15 , wine
16 , glxinfo
19 python3Packages.buildPythonApplication rec  {
20   pname = "grapejuice";
21   version = "6.2.2";
23   src = fetchFromGitLab {
24     owner = "BrinkerVII";
25     repo = "grapejuice";
26     rev = "v${version}";
27     sha256 = "sha256-wwM3q8Z4bYZod7/KcGc/PXlyLQxLRPkF1TdtFcg8mNE=";
28   };
30   nativeBuildInputs = [
31     gobject-introspection
32     desktop-file-utils
33     glib
34     wrapGAppsHook
35   ];
37   buildInputs = [
38     cairo
39     gettext
40     gtk3
41   ];
43   propagatedBuildInputs = with python3Packages; [
44     psutil
45     dbus-python
46     pygobject3
47     packaging
48     wheel
49     setuptools
50     requests
51     unidecode
52     click
53   ];
55   dontWrapGApps = true;
57   makeWrapperArgs = [
58     "\${gappsWrapperArgs[@]}"
59     "--prefix PATH : ${lib.makeBinPath [ xdg-user-dirs wine winetricks pciutils glxinfo ]}"
60     # make xdg-open overrideable at runtime
61     "--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}"
62   ];
64   postPatch = ''
65     substituteInPlace src/grapejuice_common/assets/desktop/grapejuice.desktop \
66       --replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
67       --replace \$GRAPEJUICE_GUI_EXECUTABLE "$out/bin/grapejuice-gui" \
68       --replace \$GRAPEJUICE_ICON grapejuice
70     substituteInPlace src/grapejuice_common/assets/desktop/roblox-player.desktop \
71       --replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
72       --replace \$PLAYER_ICON "grapejuice-roblox-player"
74     substituteInPlace src/grapejuice_common/assets/desktop/roblox-app.desktop \
75       --replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
76       --replace \$PLAYER_ICON "grapejuice-roblox-player"
78     substituteInPlace src/grapejuice_common/assets/desktop/roblox-studio.desktop \
79       --replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
80       --replace \$STUDIO_ICON "grapejuice-roblox-studio"
82     substituteInPlace src/grapejuice_common/paths.py \
83       --replace 'return local_share() / "locale"' 'return Path("${placeholder "out"}/share/locale")'
85     substituteInPlace src/grapejuice_common/features/settings.py \
86       --replace 'k_default_wine_home: "",' 'k_default_wine_home: "${wine}",'
87   '';
89   postInstall = ''
90     mkdir -p "$out/share/icons" "$out/share/applications" "$out/share/mime/packages"
91     cp -r src/grapejuice_common/assets/desktop/* $out/share/applications/
92     cp -r src/grapejuice_common/assets/icons $out/share/
93     cp src/grapejuice_common/assets/mime_xml/*.xml $out/share/mime/packages/
95     # compile locales (*.po -> *.mo)
96     # from https://gitlab.com/brinkervii/grapejuice/-/blob/master/src/grapejuice_common/util/mo_util.py
97     LOCALE_DIR="$out/share/locale"
98     PO_DIR="src/grapejuice_common/assets/po"
99     LINGUAS_FILE="src/grapejuice_common/assets/po/LINGUAS"
101     for lang in $(<"$LINGUAS_FILE") # extract langs from LINGUAS_FILE
102     do
103       po_file="$PO_DIR/$lang.po"
104       mo_file_dir="$LOCALE_DIR/$lang/LC_MESSAGES"
106       mkdir -p $mo_file_dir
108       mo_file="$mo_file_dir/grapejuice.mo"
109       msgfmt $po_file -o $mo_file # msgfmt from gettext
110     done
111   '';
113   # No tests
114   doCheck = false;
116   pythonImportsCheck = [ "grapejuice" ];
118   meta = with lib; {
119     homepage = "https://gitlab.com/brinkervii/grapejuice";
120     description = "Simple Wine+Roblox management tool";
121     license = licenses.gpl3Plus;
122     platforms = platforms.linux;
123     maintainers = with maintainers; [ artturin helium ];
124   };