nixpkgs/pkgs/applications/misc/lutris/default.nix
2022-12-17 04:39:52 +01:00

154 lines
2.6 KiB
Nix

{ buildPythonApplication
, lib
, fetchFromGitHub
# build inputs
, atk
, file
, gdk-pixbuf
, glib-networking
, gnome-desktop
, gobject-introspection
, gst_all_1
, gtk3
, libnotify
, pango
, webkitgtk
, wrapGAppsHook
# check inputs
, xvfb-run
, nose2
, flake8
# python dependencies
, certifi
, dbus-python
, distro
, evdev
, lxml
, pillow
, pygobject3
, pypresence
, pyyaml
, requests
# commands that lutris needs
, xrandr
, pciutils
, psmisc
, glxinfo
, vulkan-tools
, xboxdrv
, pulseaudio
, p7zip
, xgamma
, libstrangle
, wine
, fluidsynth
, xorgserver
, xorg
, util-linux
}:
let
# See lutris/util/linux.py
requiredTools = [
xrandr
pciutils
psmisc
glxinfo
vulkan-tools
xboxdrv
pulseaudio
p7zip
xgamma
libstrangle
wine
fluidsynth
xorgserver
xorg.setxkbmap
xorg.xkbcomp
# bypass mount suid wrapper which does not work in fhsenv
util-linux
];
in
buildPythonApplication rec {
pname = "lutris-unwrapped";
version = "0.5.12";
src = fetchFromGitHub {
owner = "lutris";
repo = "lutris";
rev = "refs/tags/v${version}";
sha256 = "sha256-rsiXm7L/M85ot6NrTyy//lMRFlLPJYve9y6Erg9Ugxg=";
};
nativeBuildInputs = [ wrapGAppsHook ];
buildInputs = [
atk
gdk-pixbuf
glib-networking
gnome-desktop
gobject-introspection
gtk3
libnotify
pango
webkitgtk
] ++ (with gst_all_1; [
gst-libav
gst-plugins-bad
gst-plugins-base
gst-plugins-good
gst-plugins-ugly
gstreamer
]);
# See `install_requires` in https://github.com/lutris/lutris/blob/master/setup.py
propagatedBuildInputs = [
certifi
dbus-python
distro
evdev
lxml
pillow
pygobject3
pypresence
pyyaml
requests
];
postPatch = ''
substituteInPlace lutris/util/magic.py \
--replace "'libmagic.so.1'" "'${lib.getLib file}/lib/libmagic.so.1'"
'';
checkInputs = [ xvfb-run nose2 flake8 ] ++ requiredTools;
checkPhase = ''
runHook preCheck
export HOME=$PWD
xvfb-run -s '-screen 0 800x600x24' make test
runHook postCheck
'';
# avoid double wrapping
dontWrapGApps = true;
makeWrapperArgs = [
"--prefix PATH : ${lib.makeBinPath requiredTools}"
"\${gappsWrapperArgs[@]}"
];
# needed for glib-schemas to work correctly (will crash on dialogues otherwise)
# see https://github.com/NixOS/nixpkgs/issues/56943
strictDeps = false;
meta = with lib; {
homepage = "https://lutris.net";
description = "Open Source gaming platform for GNU/Linux";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ Madouura ];
platforms = platforms.linux;
};
}