mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-25 20:34:52 +03:00
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
47 lines
1.2 KiB
Nix
47 lines
1.2 KiB
Nix
{ lib, stdenv, buildGoModule, fetchFromGitHub, buildFHSUserEnv }:
|
|
|
|
let
|
|
|
|
pkg = buildGoModule rec {
|
|
pname = "arduino-cli";
|
|
version = "0.12.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "arduino";
|
|
repo = pname;
|
|
rev = version;
|
|
sha256 = "1jlxs4szss2250zp8rz4bislgnzvqhxyp6z48dhx7zaam03hyf0w";
|
|
};
|
|
|
|
subPackages = [ "." ];
|
|
|
|
vendorSha256 = "03yj2iar63qm10fw3jh9fvz57c2sqcmngb0mj5jkhbnwf8nl7mhc";
|
|
|
|
doCheck = false;
|
|
|
|
buildFlagsArray = [
|
|
"-ldflags=-s -w -X github.com/arduino/arduino-cli/version.versionString=${version} -X github.com/arduino/arduino-cli/version.commit=unknown"
|
|
] ++ stdenv.lib.optionals stdenv.isLinux [ "-extldflags '-static'" ];
|
|
|
|
meta = with lib; {
|
|
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
|
|
'';
|
|
}
|