Skip to content

Instantly share code, notes, and snippets.

@helium18
Last active June 4, 2022 13:03
Show Gist options
  • Save helium18/66154b26db80bcd83869c17ea20e9801 to your computer and use it in GitHub Desktop.
Save helium18/66154b26db80bcd83869c17ea20e9801 to your computer and use it in GitHub Desktop.
{ lib
, fetchFromGitLab
, gobject-introspection
, python3Packages
, gtk3
, wrapGAppsHook
, glib
, cairo
, desktop-file-utils
, xdg-utils
, xdg-user-dirs
, wine
, gettext
, winetricks
}:
python3Packages.buildPythonApplication rec {
pname = "grapejuice";
version = "5.1.1";
src = fetchFromGitLab {
owner = "BrinkerVII";
repo = "grapejuice";
rev = "v5.1.1";
sha256 = "sha256-31pxQtKw5sLGnnNdboF7AAIFqsan5pXKHIHtKq/ErRE=";
};
buildInputs = [
cairo
gettext
];
propagatedBuildInputs = with python3Packages; [
psutil
dbus-python
pygobject3
packaging
wheel
setuptools
requests
unidecode
click
];
nativeBuildInputs = [
gobject-introspection
desktop-file-utils
glib
gtk3
wrapGAppsHook
];
dontWrapGApps = true;
makeWrapperArgs = [
"\${gappsWrapperArgs[@]}"
"--prefix PATH : ${lib.makeBinPath [ xdg-user-dirs xdg-utils wine winetricks ]}"
"--prefix XDG_DATA_HOME : $out"
];
postPatch = ''
substituteInPlace src/grapejuice_common/assets/desktop/grapejuice.desktop \
--replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
--replace \$GRAPEJUICE_ICON grapejuice
substituteInPlace src/grapejuice_common/assets/desktop/roblox-player.desktop \
--replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
--replace \$PLAYER_ICON "grapejuice-roblox-player"
substituteInPlace src/grapejuice_common/assets/desktop/roblox-app.desktop \
--replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
--replace \$PLAYER_ICON "grapejuice-roblox-player"
substituteInPlace src/grapejuice_common/assets/desktop/roblox-studio.desktop \
--replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
--replace \$STUDIO_ICON "grapejuice-roblox-studio"
'';
postInstall = ''
mkdir -p "$out/share/icons" "$out/share/applications" "$out/share/mime/packages"
cp -r src/grapejuice_common/assets/desktop/* $out/share/applications/
cp -r src/grapejuice_common/assets/icons $out/share/
cp src/grapejuice_common/assets/mime_xml/*.xml $out/share/mime/packages/
LOCALE_DIR="$out/share/locale"
PO_DIR="src/grapejuice_common/assets/po"
LINGUAS_FILE="src/grapejuice_common/assets/po/LINGUAS"
for lang in $(<"$LINGUAS_FILE") # extract langs from LINGUAS_FILE
do
po_file="$PO_DIR/$lang.po"
mo_file_dir="$LOCALE_DIR/$lang/LC_MESSAGES"
mkdir -p $mo_file_dir
mo_file="$mo_file_dir/grapejuice.mo"
msgfmt $po_file -o $mo_file # msgfmt from gettext
done
'';
# No tests
doCheck = false;
pythonImportsCheck = [ "grapejuice" ];
meta = with lib; {
homepage = "https://gitlab.com/brinkervii/grapejuice";
description = "Simple Wine+Roblox management tool";
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ artturin ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment