summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/rpi/WiringPi/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-10-23 21:02:02 +0200
committermakefu <github@syntax-fehler.de>2020-10-23 21:02:02 +0200
commite8b6cc0587929a7ebd0d00f83d298640b20b055f (patch)
treee0f813b8264119a84d6b8c32fa68041c8541ab59 /tv/5pkgs/rpi/WiringPi/default.nix
parentfd41a76d4cab2765f9ef95ce5322b7bffe52b8a7 (diff)
parent242530680d5dcb37a5a023d0b8f6155ab441cead (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'tv/5pkgs/rpi/WiringPi/default.nix')
-rw-r--r--tv/5pkgs/rpi/WiringPi/default.nix61
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 000000000..61c43556d
--- /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
+ ];
+ };
+}