depot/third_party/nixpkgs/pkgs/os-specific/linux/wiringpi/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

88 lines
2 KiB
Nix

{
lib,
stdenv,
symlinkJoin,
fetchFromGitHub,
libxcrypt,
}:
let
version = "3.6";
srcAll = fetchFromGitHub {
owner = "WiringPi";
repo = "WiringPi";
rev = version;
sha256 = "sha256-Hw81Ua9LTb/9l3Js1rx8TfCOF59MrrvH6AGsAsG1SoE=";
};
mkSubProject =
{
subprj, # The only mandatory argument
buildInputs ? [ ],
src ? srcAll,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "wiringpi-${subprj}";
inherit version src;
sourceRoot = "${src.name}/${subprj}";
inherit buildInputs;
# Remove (meant for other OSs) lines from Makefiles
preInstall = ''
sed -i "/chown root/d" Makefile
sed -i "/chmod/d" Makefile
'';
makeFlags = [
"DESTDIR=${placeholder "out"}"
"PREFIX=/."
# On NixOS we don't need to run ldconfig during build:
"LDCONFIG=echo"
];
});
passthru = {
# Helps nix-update and probably nixpkgs-update find the src of this package
# automatically.
src = srcAll;
inherit mkSubProject;
wiringPi = mkSubProject {
subprj = "wiringPi";
buildInputs = [ libxcrypt ];
};
devLib = mkSubProject {
subprj = "devLib";
buildInputs = [ passthru.wiringPi ];
};
wiringPiD = mkSubProject {
subprj = "wiringPiD";
buildInputs = [
libxcrypt
passthru.wiringPi
passthru.devLib
];
};
gpio = mkSubProject {
subprj = "gpio";
buildInputs = [
libxcrypt
passthru.wiringPi
passthru.devLib
];
};
};
in
symlinkJoin {
name = "wiringpi-${version}";
inherit passthru;
paths = [
passthru.wiringPi
passthru.devLib
passthru.wiringPiD
passthru.gpio
];
meta = with lib; {
description = "Gordon's Arduino wiring-like WiringPi Library for the Raspberry Pi (Unofficial Mirror for WiringPi bindings)";
homepage = "https://github.com/WiringPi/WiringPi";
license = licenses.lgpl3Plus;
maintainers = with maintainers; [ doronbehar ];
platforms = platforms.linux;
};
}