78 lines
1.6 KiB
Nix
78 lines
1.6 KiB
Nix
{ lib
|
|
, stdenv
|
|
, symlinkJoin
|
|
, srcAll
|
|
, libxcrypt
|
|
}:
|
|
let
|
|
version = "master";
|
|
|
|
mkSubProject =
|
|
{ subprj
|
|
, # The only mandatory argument
|
|
buildInputs ? [ ]
|
|
, src ? srcAll
|
|
, extraPreInstall ? ""
|
|
,
|
|
}:
|
|
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
|
|
'' + extraPreInstall;
|
|
makeFlags = [
|
|
"DESTDIR=${placeholder "out"}"
|
|
"PREFIX="
|
|
# On NixOS we don't need to run ldconfig during build:
|
|
"LDCONFIG=echo"
|
|
];
|
|
});
|
|
|
|
passthru = {
|
|
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";
|
|
extraPreInstall = ''
|
|
mkdir -p $out/bin
|
|
'';
|
|
buildInputs = [
|
|
libxcrypt
|
|
passthru.wiringPi
|
|
passthru.devLib
|
|
];
|
|
};
|
|
};
|
|
in
|
|
symlinkJoin {
|
|
name = "wiringop-${version}";
|
|
inherit passthru;
|
|
paths = builtins.attrValues {
|
|
inherit (passthru)
|
|
wiringPi
|
|
devLib
|
|
wiringPiD
|
|
gpio;
|
|
};
|
|
}
|