Martin Weinelt ae4a1a485a
treewide: add explicit format attribute for Python packages
If a Python package does not come with either `format` or `pyproject` we
consider it a setuptools build, that calls `setup.py` directly, which is
deprecated.

This change, as a first step, migrates a large chunk of these packages to
set setuptools as their explicit format

This is so we can unify the problem space for the next step of the
migration.
2025-07-02 05:56:47 +02:00

109 lines
2.1 KiB
Nix

{
lib,
python3Packages,
fetchFromGitHub,
wrapGAppsHook3,
gtk3,
gobject-introspection,
libappindicator-gtk3,
librsvg,
bluez,
linuxHeaders,
libX11,
libXext,
libXfixes,
libusb1,
udev,
udevCheckHook,
gtk-layer-shell,
}:
python3Packages.buildPythonApplication rec {
pname = "sc-controller";
version = "0.5.2";
format = "setuptools";
src = fetchFromGitHub {
owner = "C0rn3j";
repo = "sc-controller";
tag = "v${version}";
hash = "sha256-w7jVh0d8u6csXOQ6pjUCSD3R/qFVqTa2gcGa47pqn/0=";
};
nativeBuildInputs = [
wrapGAppsHook3
gobject-introspection
udevCheckHook
];
buildInputs = [
gtk3
libappindicator-gtk3
librsvg
];
dependencies =
with python3Packages;
[
evdev
pygobject3
pylibacl
vdf
ioctl-opt
]
++ [
gtk-layer-shell
python3Packages.libusb1
];
nativeCheckInputs = [
python3Packages.pytestCheckHook
python3Packages.libusb1
python3Packages.toml
];
patches = [ ./scc_osd_keyboard.patch ];
postPatch = ''
substituteInPlace scc/paths.py --replace sys.prefix "'$out'"
substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include
substituteInPlace scc/device_monitor.py --replace "find_library('bluetooth')" "'libbluetooth.so.3'"
'';
LD_LIBRARY_PATH = lib.makeLibraryPath [
libX11
libXext
libXfixes
libusb1
udev
bluez
];
preFixup = ''
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
'';
postFixup = ''
(
# scc runs these scripts as programs. (See find_binary() in scc/tools.py.)
cd $out/lib/python*/site-packages/scc/x11
patchPythonScript scc-autoswitch-daemon.py
patchPythonScript scc-osd-daemon.py
)
'';
doInstallCheck = true;
meta = {
homepage = "https://github.com/C0rn3j/sc-controller";
# donations: https://www.patreon.com/kozec
description = "User-mode driver and GUI for Steam Controller and other controllers";
license = lib.licenses.gpl2Only;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
orivej
rnhmjoj
];
};
}