2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, buildGoModule, fetchFromGitHub, buildFHSUserEnv }:
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
pkg = buildGoModule rec {
|
|
|
|
pname = "arduino-cli";
|
2020-09-25 04:45:31 +00:00
|
|
|
version = "0.12.1";
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "arduino";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2020-09-25 04:45:31 +00:00
|
|
|
sha256 = "1jlxs4szss2250zp8rz4bislgnzvqhxyp6z48dhx7zaam03hyf0w";
|
2020-08-20 17:08:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
vendorSha256 = "03yj2iar63qm10fw3jh9fvz57c2sqcmngb0mj5jkhbnwf8nl7mhc";
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
buildFlagsArray = [
|
|
|
|
"-ldflags=-s -w -X github.com/arduino/arduino-cli/version.versionString=${version} -X github.com/arduino/arduino-cli/version.commit=unknown"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [ "-extldflags '-static'" ];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-08-20 17:08:02 +00:00
|
|
|
inherit (src.meta) homepage;
|
|
|
|
description = "Arduino from the command line";
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ ryantm ];
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
# buildFHSUserEnv is needed because the arduino-cli downloads compiler
|
|
|
|
# toolchains from the internet that have their interpreters pointed at
|
|
|
|
# /lib64/ld-linux-x86-64.so.2
|
|
|
|
in buildFHSUserEnv {
|
|
|
|
inherit (pkg) name meta;
|
|
|
|
|
|
|
|
runScript = "${pkg.outPath}/bin/arduino-cli";
|
|
|
|
|
|
|
|
extraInstallCommands = ''
|
|
|
|
mv $out/bin/$name $out/bin/arduino-cli
|
|
|
|
'';
|
|
|
|
}
|