depot/third_party/nixpkgs/pkgs/development/compilers/tinygo/default.nix
Default email 66604c92c1 Project import generated by Copybara.
GitOrigin-RevId: 32b8ed738096bafb4cdb7f70347a0f63f9f40151
2020-05-15 23:57:56 +02:00

49 lines
1.3 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, llvm, clang-unwrapped, lld, avrgcc
, avrdude, openocd, gcc-arm-embedded, makeWrapper, fetchurl }:
let main = ./main.go;
gomod = ./go.mod;
in
buildGoModule rec {
pname = "tinygo";
version = "0.13.0";
src = fetchFromGitHub {
owner = "tinygo-org";
repo = "tinygo";
rev = "v${version}";
sha256 = "0x59j56y704m2hfkg78illgw9f6czrx265x887jfd989lnxphyqa";
};
overrideModAttrs = (_: {
patches = [];
preBuild = ''
rm -rf *
cp ${main} main.go
cp ${gomod} go.mod
'';
});
preBuild = "cp ${gomod} go.mod";
vendorSha256 = "19194dlzpl6zzw2gqybma5pwip71rw8z937f104k6c158qzzgy62";
enableParallelBuilding = true;
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 ];
platforms = platforms.all;
};
}