1 { lib, stdenv, buildGoModule, fetchFromGitHub, buildFHSEnv, installShellFiles, go-task }:
5 pkg = buildGoModule rec {
9 src = fetchFromGitHub {
13 hash = "sha256-brWWoIOQhU/isd48VCx6tczAJnamBuOa6e/xezuHN7E=";
24 subPackages = [ "." ];
26 vendorHash = "sha256-y7YxcBFjKcQK6ilCKOyoszq64/0xG5GgTehKrKThknU=";
30 # tries to "go install"
32 # try to Get "https://downloads.arduino.cc/libraries/library_index.tar.bz2"
33 "TestDownloadAndChecksums"
35 "TestParseReferenceCores"
37 "TestPlatformSearchSorting"
40 substituteInPlace Taskfile.yml \
41 --replace-fail "go test" "go test -p $NIX_BUILD_CORES -skip '(${lib.concatStringsSep "|" skipTests})'"
44 doCheck = stdenv.isLinux;
53 "-s" "-w" "-X github.com/arduino/arduino-cli/version.versionString=${version}" "-X github.com/arduino/arduino-cli/version.commit=unknown"
54 ] ++ lib.optionals stdenv.isLinux [ "-extldflags '-static'" ];
56 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
57 export HOME="$(mktemp -d)"
58 installShellCompletion --cmd arduino-cli \
59 --bash <($out/bin/arduino-cli completion bash) \
60 --zsh <($out/bin/arduino-cli completion zsh) \
61 --fish <($out/bin/arduino-cli completion fish)
66 inherit (src.meta) homepage;
67 description = "Arduino from the command line";
68 mainProgram = "arduino-cli";
69 changelog = "https://github.com/arduino/arduino-cli/releases/tag/${version}";
70 license = licenses.gpl3Only;
71 maintainers = with maintainers; [ ryantm ];
77 if stdenv.isLinux then
78 # buildFHSEnv is needed because the arduino-cli downloads compiler
79 # toolchains from the internet that have their interpreters pointed at
80 # /lib64/ld-linux-x86-64.so.2
83 inherit (pkg) name meta;
85 runScript = "${pkg.outPath}/bin/arduino-cli";
87 extraInstallCommands = ''
88 mv $out/bin/$name $out/bin/arduino-cli
89 '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
90 cp -r ${pkg.outPath}/share $out/share
92 passthru.pureGoPkg = pkg;
94 targetPkgs = pkgs: with pkgs; [