From 6d8a9bc6258a850a73c4709e0e9d372eb75277e1 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Wed, 4 Nov 2020 13:00:33 +0100 Subject: Add voidrice update script --- default.nix | 2 +- pkgs/hyperion-rpi3/default.nix | 83 ++++++++++++++++++++++++++++++++++------- pkgs/hyperion-rpi3/prebuilt.nix | 22 +++++++++++ pkgs/voidrice.json | 4 ++ pkgs/voidrice.nix | 9 +++-- update-voidrice.sh | 4 ++ 6 files changed, 106 insertions(+), 18 deletions(-) create mode 100644 pkgs/hyperion-rpi3/prebuilt.nix create mode 100644 pkgs/voidrice.json create mode 100755 update-voidrice.sh diff --git a/default.nix b/default.nix index 67fb506..18313eb 100644 --- a/default.nix +++ b/default.nix @@ -21,7 +21,7 @@ task-spooler = pkgs.callPackage ./pkgs/task-spooler { }; wywozik-todo = pkgs.callPackage ./pkgs/wywozik-todo { }; agate = pkgs.callPackage ./pkgs/agate { }; - hyperion-rpi3 = pkgs.callPackage ./pkgs/hyperion-rpi3 { }; + #hyperion-rpi3 = pkgs.callPackage ./pkgs/hyperion-rpi3 { }; gemget = pkgs.callPackage ./pkgs/gemget { }; st = pkgs.callPackage ./pkgs/larbs/st { }; diff --git a/pkgs/hyperion-rpi3/default.nix b/pkgs/hyperion-rpi3/default.nix index d1e8c38..5be1d46 100644 --- a/pkgs/hyperion-rpi3/default.nix +++ b/pkgs/hyperion-rpi3/default.nix @@ -1,22 +1,77 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchFromGitHub, +cmake, rsync, +qt48Full, xorg, libusb1, python3, libcec, zlib }: with stdenv.lib; -stdenv.mkDerivation { - name = "hyperion-rpi3"; +let + pname = "hyperion"; + version = "1.03.2"; - src = fetchurl { - url = "https://sourceforge.net/projects/hyperion-project/files/release/hyperion_rpi3.tar.gz"; - sha256 = "04rf1q68b80pmb9m3pqmbr761hb3zpqsb7k2bjgd8x8kyw21dh6z"; + rpiFirmware = fetchFromGitHub { + owner = "raspberrypi"; + repo = "firmware"; + rev = "1.20190925"; + sha256 = "1b7y49rgfxffx95bkfhfr9cc95si1k6rgnbn71440grch6211w1v"; }; - buildPhase = ""; - installPhase = '' - mkdir -p $out - cp -r bin $out/bin - ''; + rpiTools = fetchFromGitHub { + owner = "raspberrypi"; + repo = "tools"; + rev = "4a335520900ce55e251ac4f420f52bf0b2ab6b1f"; + sha256 = "1b7y49rgfxffx95bkfhfr9cc95si1k6rgnbn71440grch6211w1v"; + }; +in +stdenv.mkDerivation { + inherit pname version; - meta = { - description = "Hyperion is an open source ambient light software. Feel free to join us and contribute new features!"; - homepage = "https://hyperion-project.org/"; + src = fetchFromGitHub { + owner = "hyperion-project"; + repo = pname; + rev = version; + sha256 = "02l8022g7g7sdw4ybwnb6dgkd6m0m731dzcqshngxbibsp0f9k0f"; + fetchSubmodules = true; }; + + nativeBuildInputs = [ cmake rsync ]; + buildInputs = [ + qt48Full + # qt4.qtbase + # qt4.qtsvg + # qt4.qtserialport + # qt4.qtx11extras + xorg.libxcb + xorg.libXrandr + xorg.libXrender + libusb1 + libcec + python3 + zlib + ]; + + buildPhase = '' +export RASCROSS_DIR="raspberrypi" +export ROOTFS_DIR="$RASCROSS_DIR/rootfs" +export HYPERION_DIR="." +export TOOLCHAIN_FILE="$HYPERION_DIR/Toolchain-RaspberryPi.cmake" + +export NATIVE_BUILD_DIR="$HYPERION_DIR/build" +export TARGET_BUILD_DIR="$HYPERION_DIR/build-rpi" + +mkdir -p "$ROOTFS_DIR" + +mkdir -p "$RASCROSS_DIR/firmware" +cp -r ${rpiFirmware} "$RASCROSS_DIR/firmware" +ln -s "$RASCROSS_DIR/firmware/hardfp/opt" "$ROOTFS_DIR/opt" + +cp -r ${rpiTools} "$RASCROSS_DIR/tools" + +mkdir -p "$NATIVE_BUILD_DIR" +cmake -DENABLE_DISPMANX=OFF --build "$NATIVE_BUILD_DIR" "$HYPERION_DIR" + +# do the cross build +# specify the protoc export file to import the protobuf compiler from the native build +mkdir -p "$TARGET_BUILD_DIR" +cmake -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" -DIMPORT_PROTOC=$NATIVE_BUILD_DIR/protoc_export.cmake --build "$TARGET_BUILD_DIR" "$HYPERION_DIR" +''; + } diff --git a/pkgs/hyperion-rpi3/prebuilt.nix b/pkgs/hyperion-rpi3/prebuilt.nix new file mode 100644 index 0000000..d1e8c38 --- /dev/null +++ b/pkgs/hyperion-rpi3/prebuilt.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchurl }: +with stdenv.lib; + +stdenv.mkDerivation { + name = "hyperion-rpi3"; + + src = fetchurl { + url = "https://sourceforge.net/projects/hyperion-project/files/release/hyperion_rpi3.tar.gz"; + sha256 = "04rf1q68b80pmb9m3pqmbr761hb3zpqsb7k2bjgd8x8kyw21dh6z"; + }; + + buildPhase = ""; + installPhase = '' + mkdir -p $out + cp -r bin $out/bin + ''; + + meta = { + description = "Hyperion is an open source ambient light software. Feel free to join us and contribute new features!"; + homepage = "https://hyperion-project.org/"; + }; +} diff --git a/pkgs/voidrice.json b/pkgs/voidrice.json new file mode 100644 index 0000000..d1112ad --- /dev/null +++ b/pkgs/voidrice.json @@ -0,0 +1,4 @@ +{ + "rev": "a801ddcbfcf1c0fd01a0c06975571e56c51b077b", + "sha256": "0gjzfsmpnnb4vbcbgwx0g2z240zz9kckns1j109lfc0kq0xi93zw" +} diff --git a/pkgs/voidrice.nix b/pkgs/voidrice.nix index 9acf6c2..d4611a0 100644 --- a/pkgs/voidrice.nix +++ b/pkgs/voidrice.nix @@ -1,7 +1,10 @@ { pkgs ? import }: - +with builtins; +let + specs = fromJSON (readFile ./voidrice.json); +in pkgs.fetchgit { url = "https://github.com/LukeSmithxyz/voidrice"; - rev = "b768fc601e9b587aa800cd0656a8eee170bd1c93"; - sha256 = "1i35n0qfh0llfg1b8la9yj7qsycwlmipgfp6k1yz9r27gjll768z"; + rev = specs.rev; + sha256 = specs.sha256; } diff --git a/update-voidrice.sh b/update-voidrice.sh new file mode 100755 index 0000000..615502c --- /dev/null +++ b/update-voidrice.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i sh -p nix-prefetch-git jq + +nix-prefetch-git --fetch-submodules "https://github.com/LukeSmithxyz/voidrice" | jq '{ rev: .rev, sha256: .sha256 }' > pkgs/voidrice.json -- cgit 1.4.1