Add multiple GPIO related packages by joan2937 (#352308)

This commit is contained in:
Doron Behar 2025-05-29 17:11:00 +03:00 committed by GitHub
commit 6b312e2cca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 183 additions and 0 deletions

View file

@ -0,0 +1,71 @@
{
lib,
stdenv,
fetchFromGitHub,
swig,
# If we build the python packages, these two are not null
buildPythonPackage ? null,
lgpioWithoutPython ? null,
# When building a python Packages, this specifies the python subproject
pyProject ? "",
}:
let
mkDerivation = if pyProject == "" then stdenv.mkDerivation else buildPythonPackage;
in
mkDerivation rec {
pname = "lgpio";
version = "0.2.2";
src = fetchFromGitHub {
owner = "joan2937";
repo = "lg";
tag = "v${version}";
hash = "sha256-92lLV+EMuJj4Ul89KIFHkpPxVMr/VvKGEocYSW2tFiE=";
};
nativeBuildInputs = lib.optionals (pyProject == "PY_LGPIO") [
swig
];
preConfigure =
if pyProject != "" then
''
cd ${pyProject}
''
else
"";
# Emulate ldconfig when building the C API
postConfigure =
if pyProject == "" then
''
substituteInPlace Makefile \
--replace ldconfig 'echo ldconfig'
''
else
"";
preBuild =
if pyProject == "PY_LGPIO" then
''
swig -python lgpio.i
''
else
"";
buildInputs = [
lgpioWithoutPython
];
makeFlags = [
"prefix=$(out)"
];
meta = {
description = "Linux C libraries and Python modules for manipulating GPIO";
homepage = "https://github.com/joan2937/lg";
license = with lib.licenses; [ unlicense ];
maintainers = with lib.maintainers; [ doronbehar ];
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,35 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
buildPythonPackage ? null,
}:
let
mkDerivation =
if builtins.isNull buildPythonPackage then stdenv.mkDerivation else buildPythonPackage;
in
mkDerivation rec {
pname = "pigpio";
version = "79";
src = fetchFromGitHub {
owner = "joan2937";
repo = "pigpio";
tag = "v${version}";
hash = "sha256-Z+SwUlBbtWtnbjTe0IghR3gIKS43ZziN0amYtmXy7HE=";
};
nativeBuildInputs = [
cmake
];
meta = {
description = "C library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO)";
homepage = "https://github.com/joan2937/pigpio";
license = with lib.licenses; [ unlicense ];
maintainers = with lib.maintainers; [ doronbehar ];
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,56 @@
{
lib,
stdenv,
fetchFromGitHub,
# nativeBuildInputs
pkg-config,
wrapGAppsHook3,
installShellFiles,
# buildInputs
gtk3,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "piscope";
version = "0.8";
src = fetchFromGitHub {
owner = "joan2937";
repo = "piscope";
tag = "V${finalAttrs.version}";
hash = "sha256-VDrx/RLSpMhyD64PmdeWVacb9LleHakcy7D6zFxeyhw=";
};
# Fix FHS paths
postConfigure = ''
substituteInPlace piscope.c \
--replace /usr/share/piscope $out/share/piscope
'';
nativeBuildInputs = [
pkg-config
wrapGAppsHook3
installShellFiles
];
buildInputs = [
gtk3
];
# Upstream's Makefile assumes FHS
installPhase = ''
runHook preInstall
installBin piscope
install -D -m 0644 piscope.glade $out/share/piscope/piscope.glade
runHook postInstall
'';
meta = {
homepage = "http://abyz.me.uk/rpi/pigpio/piscope.html";
description = "A logic analyser (digital waveform viewer) for the Raspberry";
license = lib.licenses.unlicense;
maintainers = with lib.maintainers; [ doronbehar ];
platforms = lib.platforms.linux;
};
})

View file

@ -7793,6 +7793,14 @@ self: super: with self; {
lexilang = callPackage ../development/python-modules/lexilang { };
lgpio = toPythonModule (
pkgs.lgpio.override {
inherit buildPythonPackage;
pyProject = "PY_LGPIO";
lgpioWithoutPython = pkgs.lgpio;
}
);
lhapdf = toPythonModule (pkgs.lhapdf.override { python3 = python; });
lib4package = callPackage ../development/python-modules/lib4package { };
@ -11176,6 +11184,12 @@ self: super: with self; {
piexif = callPackage ../development/python-modules/piexif { };
pigpio = toPythonModule (
pkgs.pigpio.override {
inherit buildPythonPackage;
}
);
pijuice = callPackage ../development/python-modules/pijuice { };
pika = callPackage ../development/python-modules/pika { };
@ -15199,6 +15213,13 @@ self: super: with self; {
rflink = callPackage ../development/python-modules/rflink { };
rgpio = toPythonModule (
pkgs.lgpio.override {
inherit buildPythonPackage;
pyProject = "PY_RGPIO";
}
);
rich = callPackage ../development/python-modules/rich { };
rich-argparse = callPackage ../development/python-modules/rich-argparse { };