2020-04-24 23:36:52 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, llvm, clang-unwrapped, lld, avrgcc
|
2020-05-15 21:57:56 +00:00
|
|
|
, avrdude, openocd, gcc-arm-embedded, makeWrapper, fetchurl }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
let main = ./main.go;
|
|
|
|
gomod = ./go.mod;
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
buildGoModule rec {
|
|
|
|
pname = "tinygo";
|
2020-05-29 06:06:01 +00:00
|
|
|
version = "0.13.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tinygo-org";
|
|
|
|
repo = "tinygo";
|
|
|
|
rev = "v${version}";
|
2020-05-29 06:06:01 +00:00
|
|
|
sha256 = "0das5z5y2x1970yi9c4yssxvwrrjhdmsj495q0r5mb02amvc954v";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
overrideModAttrs = (_: {
|
|
|
|
patches = [];
|
|
|
|
preBuild = ''
|
|
|
|
rm -rf *
|
|
|
|
cp ${main} main.go
|
|
|
|
cp ${gomod} go.mod
|
|
|
|
'';
|
|
|
|
});
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
preBuild = "cp ${gomod} go.mod";
|
|
|
|
|
|
|
|
vendorSha256 = "19194dlzpl6zzw2gqybma5pwip71rw8z937f104k6c158qzzgy62";
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
subPackages = [ "." ];
|
|
|
|
buildInputs = [ llvm clang-unwrapped makeWrapper ];
|
|
|
|
propagatedBuildInputs = [ lld avrgcc avrdude openocd gcc-arm-embedded ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/tinygo
|
|
|
|
cp -a lib src targets $out/share/tinygo
|
|
|
|
wrapProgram $out/bin/tinygo --prefix "TINYGOROOT" : "$out/share/tinygo"
|
|
|
|
ln -sf $out/bin $out/share/tinygo
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://tinygo.org/";
|
|
|
|
description = "Go compiler for small places";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ chiiruno ];
|
|
|
|
};
|
|
|
|
}
|