From 0bdfa8921f176a2e6198924ec25cc52c7fc0ca7e Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Fri, 13 Jun 2025 10:12:11 +0300 Subject: [PATCH] lgpio: document pyProject options & use lib.optionalString --- pkgs/by-name/lg/lgpio/package.nix | 41 ++++++++++++++----------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/pkgs/by-name/lg/lgpio/package.nix b/pkgs/by-name/lg/lgpio/package.nix index f9283d7aec50..185dd2f0b869 100644 --- a/pkgs/by-name/lg/lgpio/package.nix +++ b/pkgs/by-name/lg/lgpio/package.nix @@ -6,7 +6,14 @@ # 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 + # When building a python Packages, this specifies the python subproject - a + # folder in the repository. The current options are: + # + # - + # - PY_LGPIO + # - PY_RGPIO + # + # Where an empty value means 'build the non python project'. pyProject ? "", }: @@ -28,30 +35,18 @@ mkDerivation rec { swig ]; - preConfigure = - if pyProject != "" then - '' - cd ${pyProject} - '' - else - ""; + preConfigure = lib.optionalString (pyProject != "") '' + cd ${pyProject} + ''; # Emulate ldconfig when building the C API - postConfigure = - if pyProject == "" then - '' - substituteInPlace Makefile \ - --replace ldconfig 'echo ldconfig' - '' - else - ""; + postConfigure = lib.optionalString (pyProject == "") '' + substituteInPlace Makefile \ + --replace ldconfig 'echo ldconfig' + ''; - preBuild = - if pyProject == "PY_LGPIO" then - '' - swig -python lgpio.i - '' - else - ""; + preBuild = lib.optionalString (pyProject == "PY_LGPIO") '' + swig -python lgpio.i + ''; buildInputs = [ lgpioWithoutPython