uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,59 @@
{ stdenv, coreutils, lib, installShellFiles, zlib, autoPatchelfHook, fetchurl, callPackage }:
let
pname = "scala-cli";
sources = builtins.fromJSON (builtins.readFile ./sources.json);
inherit (sources) version assets;
platforms = builtins.attrNames assets;
in
stdenv.mkDerivation {
inherit pname version;
nativeBuildInputs = [ installShellFiles ]
++ lib.optional stdenv.isLinux autoPatchelfHook;
buildInputs = [ coreutils zlib stdenv.cc.cc ];
src =
let
asset = assets."${stdenv.hostPlatform.system}" or (throw "Unsupported platform ${stdenv.hostPlatform.system}");
in
fetchurl {
url = "https://github.com/Virtuslab/scala-cli/releases/download/v${version}/${asset.asset}";
sha256 = asset.sha256;
};
unpackPhase = ''
runHook preUnpack
gzip -d < $src > scala-cli
runHook postUnpack
'';
installPhase = ''
runHook preInstall
install -Dm755 scala-cli $out/bin/scala-cli
runHook postInstall
'';
# We need to call autopatchelf before generating completions
dontAutoPatchelf = true;
postFixup = lib.optionalString stdenv.isLinux ''
autoPatchelf $out
'' + ''
# hack to ensure the completion function looks right
# as $0 is used to generate the compdef directive
PATH="$out/bin:$PATH"
installShellCompletion --cmd scala-cli \
--bash <(scala-cli completions bash) \
--zsh <(scala-cli completions zsh)
'';
meta = with lib; {
homepage = "https://scala-cli.virtuslab.org";
downloadPage = "https://github.com/VirtusLab/scala-cli/releases/v${version}";
license = licenses.asl20;
description = "Command-line tool to interact with the Scala language";
maintainers = [ maintainers.kubukoz ];
};
passthru.updateScript = callPackage ./update.nix { } { inherit platforms pname version; };
}

View file

@ -0,0 +1,13 @@
{
"version": "0.1.7",
"assets": {
"x86_64-darwin": {
"asset": "scala-cli-x86_64-apple-darwin.gz",
"sha256": "1sly3s9y742nms8kqwh2cikjkcnbkkafsql8sw2w2zr53z28g10v"
},
"x86_64-linux": {
"asset": "scala-cli-x86_64-pc-linux.gz",
"sha256": "1lgcbxzhwqfnj6n81w1ssdcrn1j0c93chqgh0zzqi08w8wk3x4j5"
}
}
}

View file

@ -0,0 +1,37 @@
{ lib, curl, writeShellScript, jq, gnused, git, nix, coreutils }: { platforms, pname, version }:
writeShellScript "${pname}-update-script" ''
set -o errexit
PATH=${lib.makeBinPath [ curl jq gnused git nix coreutils ]}
latest_version=$(curl -s "https://api.github.com/repos/VirtusLab/scala-cli/releases?per_page=1" | jq ".[0].tag_name" --raw-output | sed 's/^v//')
if [[ "${version}" = "$latest_version" ]]; then
echo "The new version same as the old version."
exit 0
fi
nixpkgs=$(git rev-parse --show-toplevel)
sources_json="$nixpkgs/pkgs/development/tools/build-managers/scala-cli/sources.json"
platform_assets=()
for platform in ${lib.concatStringsSep " " platforms}; do
asset=$(jq ".assets.\"$platform\".asset" --raw-output < $sources_json)
release_asset_url="https://github.com/Virtuslab/scala-cli/releases/download/v$latest_version/$asset"
asset_hash=$(nix-prefetch-url "$release_asset_url")
asset_object=$(jq --compact-output --null-input \
--arg asset "$asset" \
--arg sha256 "$asset_hash" \
--arg platform "$platform" \
'{asset: $asset, sha256: $sha256, platform: $platform}')
platform_assets+=($asset_object)
done
printf '%s\n' "''${platform_assets[@]}" | \
jq -s "map ( { (.platform): . | del(.platform) }) | add" | \
jq --arg version $latest_version \
'{ version: $version, assets: . }' > $sources_json
''