Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
68 lines
1.6 KiB
Nix
68 lines
1.6 KiB
Nix
{
|
|
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 - a
|
|
# folder in the repository. The current options are:
|
|
#
|
|
# - <empty>
|
|
# - PY_LGPIO
|
|
# - PY_RGPIO
|
|
#
|
|
# Where an empty value means 'build the non python project'.
|
|
pyProject ? "",
|
|
}:
|
|
|
|
let
|
|
mkDerivation = if pyProject == "" then stdenv.mkDerivation else buildPythonPackage;
|
|
in
|
|
mkDerivation rec {
|
|
pname = "lgpio";
|
|
version = "0.2.2";
|
|
format = if pyProject == "" then null else "setuptools";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "joan2937";
|
|
repo = "lg";
|
|
tag = "v${version}";
|
|
hash = "sha256-92lLV+EMuJj4Ul89KIFHkpPxVMr/VvKGEocYSW2tFiE=";
|
|
};
|
|
|
|
nativeBuildInputs = lib.optionals (pyProject == "PY_LGPIO") [
|
|
swig
|
|
];
|
|
|
|
preConfigure = lib.optionalString (pyProject != "") ''
|
|
cd ${pyProject}
|
|
'';
|
|
# Emulate ldconfig when building the C API
|
|
postConfigure = lib.optionalString (pyProject == "") ''
|
|
substituteInPlace Makefile \
|
|
--replace ldconfig 'echo ldconfig'
|
|
'';
|
|
|
|
preBuild = lib.optionalString (pyProject == "PY_LGPIO") ''
|
|
swig -python lgpio.i
|
|
'';
|
|
|
|
buildInputs = [
|
|
lgpioWithoutPython
|
|
];
|
|
|
|
makeFlags = [
|
|
"prefix=$(out)"
|
|
];
|
|
|
|
meta = {
|
|
description = "Linux C libraries and Python modules for manipulating GPIO";
|
|
homepage = "https://github.com/joan2937/lg";
|
|
license = lib.licenses.unlicense;
|
|
maintainers = with lib.maintainers; [ doronbehar ];
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
}
|