1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-20 00:19:25 +03:00
nixpkgs/pkgs/development/embedded/arduino/arduino-cli/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

72 lines
1.8 KiB
Nix
Raw Normal View History

{ lib, stdenv, buildGoModule, fetchFromGitHub, buildFHSUserEnv, installShellFiles }:
2020-08-07 15:17:57 -07:00
let
pkg = buildGoModule rec {
pname = "arduino-cli";
2023-03-19 11:38:19 +01:00
version = "0.31.0";
2020-08-07 15:17:57 -07:00
src = fetchFromGitHub {
owner = "arduino";
repo = pname;
rev = version;
2023-03-19 11:38:19 +01:00
hash = "sha256-y51/5Gu6nTaL+XLP7hLk/gaksIdRahecl5q5jYBWATE=";
2020-08-07 15:17:57 -07:00
};
nativeBuildInputs = [
installShellFiles
];
2020-08-07 15:17:57 -07:00
subPackages = [ "." ];
2023-03-19 11:38:19 +01:00
vendorSha256 = "sha256-JuuGJuSax2tfuQHH/Hqk1JpQE2OboYJKJjzPjIZ1UD8=";
2020-08-07 15:17:57 -07:00
doCheck = false;
2021-08-26 16:45:51 +10:00
ldflags = [
"-s" "-w" "-X github.com/arduino/arduino-cli/version.versionString=${version}" "-X github.com/arduino/arduino-cli/version.commit=unknown"
] ++ lib.optionals stdenv.isLinux [ "-extldflags '-static'" ];
2020-08-07 15:17:57 -07:00
postInstall = ''
export HOME="$(mktemp -d)"
for s in {bash,zsh,fish}; do
$out/bin/arduino-cli completion $s > completion.$s
installShellCompletion --cmd arduino-cli --$s completion.$s
done
unset HOME
'';
meta = with lib; {
2020-08-07 15:17:57 -07:00
inherit (src.meta) homepage;
description = "Arduino from the command line";
2023-01-17 14:54:06 +01:00
changelog = "https://github.com/arduino/arduino-cli/releases/tag/${version}";
2020-08-07 15:17:57 -07:00
license = licenses.gpl3Only;
maintainers = with maintainers; [ ryantm ];
};
};
in
if stdenv.isLinux then
2020-08-07 15:17:57 -07: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
buildFHSUserEnv
{
inherit (pkg) name meta;
runScript = "${pkg.outPath}/bin/arduino-cli";
extraInstallCommands = ''
mv $out/bin/$name $out/bin/arduino-cli
cp -r ${pkg.outPath}/share $out/share
'';
passthru.pureGoPkg = pkg;
targetPkgs = pkgs: with pkgs; [
zlib
];
}
else
pkg