diff options
author | tv <tv@krebsco.de> | 2020-10-15 13:47:46 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2020-10-15 15:08:25 +0200 |
commit | f99277f85c331508ae3f08e061921c4471040166 (patch) | |
tree | 7a264807e804acf5f63cf94d180fb2b583aeafbd /tv/5pkgs/rpi/WiringPi/default.nix | |
parent | 31535c3d0e98e76c535cf7d0b500b6e2bedd3fc6 (diff) |
tv rpiPacakges.WiringPi: init at 2020-09-14
Diffstat (limited to 'tv/5pkgs/rpi/WiringPi/default.nix')
-rw-r--r-- | tv/5pkgs/rpi/WiringPi/default.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tv/5pkgs/rpi/WiringPi/default.nix b/tv/5pkgs/rpi/WiringPi/default.nix new file mode 100644 index 0000000..61c4355 --- /dev/null +++ b/tv/5pkgs/rpi/WiringPi/default.nix @@ -0,0 +1,61 @@ +{ fetchFromGitHub, runCommand, stdenv }: + +let + generic = name: extraAttrs: + stdenv.mkDerivation ({ + pname = "WiringPi-${name}"; + version = "2020-09-14"; + + src = fetchFromGitHub (stdenv.lib.importJSON ./src.json); + + buildPhase = '' + runHook postBuild + + make -C ${name} all + + runHook preBuild + ''; + + installPhase = '' + runHook preInstall + + export DESTDIR=$out + export PREFIX= + export LDCONFIG=true + + make -C ${name} install + + runHook postInstall + ''; + } // extraAttrs); + + fakeutils = runCommand "fakeutils-1.0" {} /* sh */ '' + mkdir -p $out/bin + for name in chown chmod; do + touch $out/bin/$name + chmod +x $out/bin/$name + done + ''; +in + +rec { + wiringPi = generic "wiringPi" {}; + wiringPiDev = generic "devLib" { + buildInputs = [ + wiringPi + ]; + }; + gpio = generic "gpio" { + preInstall = '' + # fakeutils cannot be buildInputs because they have to override existing + # executables and therefore need to be prepended to the search path. + PATH=${fakeutils}/bin:$PATH + + mkdir -p $out/bin + ''; + buildInputs = [ + wiringPi + wiringPiDev + ]; + }; +} |