nixpkgs/pkgs/games/grapejuice/default.nix

139 lines
3.9 KiB
Nix
Raw Normal View History

2021-06-18 18:47:51 +00:00
{ lib
, fetchFromGitLab
, gobject-introspection
, pciutils
2021-06-18 18:47:51 +00:00
, python3Packages
, gtk3
, wrapGAppsHook3
2021-06-18 18:47:51 +00:00
, glib
, cairo
, desktop-file-utils
, xdg-utils
, xdg-user-dirs
, gettext
2021-06-18 18:47:51 +00:00
, winetricks
, wine
2022-01-13 17:15:15 +00:00
, glxinfo
2022-12-03 00:48:11 +00:00
, xrandr
, bash
2021-06-18 18:47:51 +00:00
}:
python3Packages.buildPythonApplication rec {
pname = "grapejuice";
2023-09-06 13:45:18 +00:00
version = "7.20.11";
2021-06-18 18:47:51 +00:00
src = fetchFromGitLab {
owner = "BrinkerVII";
repo = "grapejuice";
rev = "v${version}";
2023-09-06 13:45:18 +00:00
hash = "sha256-sDw67Xseeak1v5x0daznfdeNQahDTj21AVvXmuZlsgg=";
2021-06-18 18:47:51 +00:00
};
nativeBuildInputs = [
gobject-introspection
desktop-file-utils
glib
wrapGAppsHook3
2023-08-28 23:32:10 +00:00
python3Packages.pip
2021-06-18 18:47:51 +00:00
];
buildInputs = [
cairo
gettext
gtk3
bash
2021-06-18 18:47:51 +00:00
];
propagatedBuildInputs = with python3Packages; [
psutil
2021-06-18 18:47:51 +00:00
dbus-python
pygobject3
2021-06-18 18:47:51 +00:00
packaging
wheel
2021-06-18 18:47:51 +00:00
setuptools
requests
2022-01-13 17:15:15 +00:00
unidecode
click
2022-12-03 00:48:11 +00:00
pydantic
2021-06-18 18:47:51 +00:00
];
dontWrapGApps = true;
makeWrapperArgs = [
2022-12-03 00:48:11 +00:00
"--prefix PATH : ${lib.makeBinPath [ xdg-user-dirs wine winetricks pciutils glxinfo xrandr ]}"
# make xdg-open overrideable at runtime
"--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}"
2021-06-18 18:47:51 +00:00
];
postPatch = ''
substituteInPlace src/grapejuice_common/assets/desktop/grapejuice.desktop \
--replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
--replace \$GRAPEJUICE_GUI_EXECUTABLE "$out/bin/grapejuice-gui" \
2021-06-18 18:47:51 +00:00
--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 src/grapejuice_common/assets/desktop/roblox-studio-auth.desktop \
2021-06-18 18:47:51 +00:00
--replace \$GRAPEJUICE_EXECUTABLE "$out/bin/grapejuice" \
--replace \$STUDIO_ICON "grapejuice-roblox-studio"
substituteInPlace src/grapejuice_common/paths.py \
--replace 'return local_share() / "locale"' 'return Path("${placeholder "out"}/share/locale")'
2022-12-03 00:48:11 +00:00
substituteInPlace src/grapejuice_common/models/settings_model.py \
--replace 'default_wine_home: Optional[str] = ""' 'default_wine_home: Optional[str] = "${wine}"'
substituteInPlace src/grapejuice_packaging/builders/linux_package_builder.py \
--replace '"--no-dependencies",' '"--no-dependencies", "--no-build-isolation",'
substituteInPlace src/grapejuice_packaging/packaging_resources/bin/grapejuice src/grapejuice_packaging/packaging_resources/bin/grapejuice-gui \
--replace "/usr/bin/env python3" "${python3Packages.python.interpreter}"
2021-06-18 18:47:51 +00:00
'';
installPhase = ''
runHook preInstall
PYTHONPATH=$(pwd)/src:$PYTHONPATH python3 -m grapejuice_packaging linux_package
mkdir -p "$out" "$out/${python3Packages.python.sitePackages}"
tar -xvf ./dist/linux_package/grapejuice-''${version}.tar.gz --strip-components=1 -C "$out"
mv "$out/lib/python3/dist-packages/"* "$out/${python3Packages.python.sitePackages}"
rmdir --ignore-fail-on-non-empty -p "$out/lib/python3/dist-packages"
runHook postInstall
'';
postFixup = ''
patchShebangs "$out/bin/grapejuice{,-gui}"
buildPythonPath "$out $pythonPath"
for bin in grapejuice grapejuice-gui; do
wrapProgram "$out/bin/$bin" \
--prefix PYTHONPATH : "$PYTHONPATH:$(toPythonPath $out)" \
''${makeWrapperArgs[@]} \
''${gappsWrapperArgs[@]}
done
2021-06-18 18:47:51 +00:00
'';
# No tests
doCheck = false;
pythonImportsCheck = [ "grapejuice" ];
meta = with lib; {
homepage = "https://gitlab.com/brinkervii/grapejuice";
description = "Simple Wine+Roblox management tool";
2021-06-18 18:47:51 +00:00
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ artturin helium ];
2021-06-18 18:47:51 +00:00
};
}