2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, buildGoModule, fetchFromGitHub, buildFHSUserEnv }:
|
2020-08-08 00:17:57 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
pkg = buildGoModule rec {
|
|
|
|
pname = "arduino-cli";
|
2021-05-08 12:14:30 +02:00
|
|
|
version = "0.18.1";
|
2020-08-08 00:17:57 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "arduino";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2021-05-08 12:14:30 +02:00
|
|
|
sha256 = "sha256-EtkONrP/uaetsdC47WsyQOE71Gsz0wKUiTiYThj8Kq8=";
|
2020-08-08 00:17:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
2021-05-08 12:14:30 +02:00
|
|
|
vendorSha256 = "sha256-kPIhG6lsH+0IrYfdlzdv/X/cUQb22Xza9Q6ywjKae/4=";
|
2020-08-08 00:17:57 +02:00
|
|
|
|
2020-08-04 02:26:27 +02:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-08-08 00:17:57 +02:00
|
|
|
buildFlagsArray = [
|
|
|
|
"-ldflags=-s -w -X github.com/arduino/arduino-cli/version.versionString=${version} -X github.com/arduino/arduino-cli/version.commit=unknown"
|
2021-01-17 19:11:59 +01:00
|
|
|
] ++ lib.optionals stdenv.isLinux [ "-extldflags '-static'" ];
|
2020-08-08 00:17:57 +02:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-08-08 00:17:57 +02:00
|
|
|
inherit (src.meta) homepage;
|
|
|
|
description = "Arduino from the command line";
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ ryantm ];
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-05-08 12:14:30 +02:00
|
|
|
in
|
|
|
|
if stdenv.isLinux then
|
2020-08-08 00:17:57 +02:00
|
|
|
# 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
|
2021-05-08 12:14:30 +02:00
|
|
|
buildFHSUserEnv
|
|
|
|
{
|
|
|
|
inherit (pkg) name meta;
|
|
|
|
|
|
|
|
runScript = "${pkg.outPath}/bin/arduino-cli";
|
|
|
|
|
|
|
|
extraInstallCommands = ''
|
|
|
|
mv $out/bin/$name $out/bin/arduino-cli
|
|
|
|
'';
|
2021-06-29 09:49:45 +02:00
|
|
|
|
|
|
|
targetPkgs = pkgs: with pkgs; [
|
|
|
|
zlib
|
|
|
|
];
|
2021-05-08 12:14:30 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pkg
|