Skip to content

Instantly share code, notes, and snippets.

@yorickvP
Created October 3, 2020 13:04
Show Gist options
  • Save yorickvP/a49044800881ebbc0616b6a77847d97d to your computer and use it in GitHub Desktop.
Save yorickvP/a49044800881ebbc0616b6a77847d97d to your computer and use it in GitHub Desktop.
{ stdenvNoCC, fetchFromGitHub, telink-825x-sdk, tc32-gcc, python3 }:
stdenvNoCC.mkDerivation {
pname = "ATC_Thermometer";
version = "20201003";
src = "${fetchFromGitHub {
owner = "atc1441";
repo = "ATC_MiThermometer";
rev = "772348a2266ea22bd58795314be148a8154e6462";
sha256 = "05ggw0c61fbhw751c5icpv31i0cjk2nx5nmnkixid07ajsmhb7fw";
}}/ATC_Thermometer";
enableParallelBuilding = true;
nativeBuildInputs = [ tc32-gcc python3 ];
makeFlags = [ "TEL_PATH=${telink-825x-sdk}" ];
installPhase = ''
runHook preInstall
mkdir $out
cp -r ATC_Thermometer.bin $_
runHook postInstall
'';
}
with import ./pkgs.nix; atc_thermometer
import (builtins.fetchTarball channel:nixos-unstable) {
overlays = [ (self: super: {
tc32-gcc = super.callPackage ./tc32-gcc.nix {};
telink-825x-sdk = super.callPackage ./telink-825x-sdk.nix {};
atc_thermometer = super.callPackage ./atc_thermometer.nix {};
}) ];
}
{ stdenv
, fetchurl, autoPatchelfHook
, zlib, ncurses5, expat, libusb, libusb-compat-0_1
}:
stdenv.mkDerivation {
pname = "tc32-gcc";
version = "2.0";
src = fetchurl {
url = "http://shyboy.oss-cn-shenzhen.aliyuncs.com/readonly/tc32_gcc_v2.0.tar.bz2";
sha256 = "0c5lj5wxwmjr1558cqnmskgr877ashndmkfsnjjdpcrx7sz59f1k";
};
buildInputs = [
zlib ncurses5 expat
libusb libusb-compat-0_1
];
nativeBuildInputs = [
autoPatchelfHook
];
unpackPhase = ''
tar xf $src
'';
installPhase = ''
mkdir $out
cp -r tc32/bin $out/bin
cp -r tc32/lib $out/lib
cp -r tc32/share $out/share
# ...
cp -r tc32/include $out/include
cp -r tc32/tc32-elf $out/tc32-elf
'';
meta = {
description = "Toolchain for the Telink TC32 platform, as prebuilt gcc binaries";
platforms = [ "x86_64-linux" ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment