From 5f070790ccdcc28cf0590ff5b740bec25ca69d75 Mon Sep 17 00:00:00 2001 From: Ole Kristian Pedersen Date: Sat, 1 Oct 2022 13:45:44 +0200 Subject: [PATCH] azure-functions-core-tools: Add darwin support, upgrade to v4 --- .../azure-functions-core-tools/default.nix | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/pkgs/development/tools/azure-functions-core-tools/default.nix b/pkgs/development/tools/azure-functions-core-tools/default.nix index 6693d83e1f146..251493d0deb37 100644 --- a/pkgs/development/tools/azure-functions-core-tools/default.nix +++ b/pkgs/development/tools/azure-functions-core-tools/default.nix @@ -16,12 +16,20 @@ stdenv.mkDerivation rec { pname = "azure-functions-core-tools"; - version = "3.0.3785"; + version = "4.0.4785"; - src = fetchurl { - url = "https://github.com/Azure/${pname}/releases/download/${version}/Azure.Functions.Cli.linux-x64.${version}.zip"; - sha256 = "sha256-NdTEFQaG8eFengjzQr51ezehIHFvQZqmrjpjWk4vZKo="; - }; + src = + if stdenv.isLinux then + fetchurl { + url = "https://github.com/Azure/${pname}/releases/download/${version}/Azure.Functions.Cli.linux-x64.${version}.zip"; + sha256 = "sha256-SWvbPEslwhYNd2fTQJWy1+823o1vJR/roPstgelSfnQ="; + } + else + fetchurl { + url = "https://github.com/Azure/${pname}/releases/download/${version}/Azure.Functions.Cli.osx-x64.${version}.zip"; + sha256 = "sha256-m06XeUHVDCxo7sfK4eF1oM6IuaVET9jr/xSO9qzpxSU="; + } + ; nativeBuildInputs = [ unzip @@ -50,13 +58,17 @@ stdenv.mkDerivation rec { installPhase = '' mkdir -p $out/bin - cp -prd *.dll *.so gozip func $out/bin + cp -prd . $out/bin/azure-functions-core-tools + chmod +x $out/bin/azure-functions-core-tools/{func,gozip} + '' + lib.optionalString stdenv.isLinux '' patchelf \ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - --set-rpath "${libPath}" "$out/bin/func" - chmod +x $out/bin/func $out/bin/gozip - find $out/bin -type f -name "*.so" -exec patchelf --set-rpath "${libPath}" {} \; - wrapProgram "$out/bin/func" --prefix LD_LIBRARY_PATH : ${libPath} + --set-rpath "${libPath}" "$out/bin/azure-functions-core-tools/func" + find $out/bin/azure-functions-core-tools -type f -name "*.so" -exec patchelf --set-rpath "${libPath}" {} \; + wrapProgram "$out/bin/azure-functions-core-tools/func" --prefix LD_LIBRARY_PATH : ${libPath} + '' + '' + ln -s $out/bin/{azure-functions-core-tools,}/func + ln -s $out/bin/{azure-functions-core-tools,}/gozip ''; dontStrip = true; # Causes rpath patching to break if not set @@ -69,6 +81,6 @@ stdenv.mkDerivation rec { ]; license = licenses.mit; maintainers = with maintainers; [ jshcmpbll ]; - platforms = platforms.linux; + platforms = platforms.unix; }; }