@@ -0,0 +1,74 @@
1+{ stdenv
2+, lib
3+, config
4+, fetchurl
5+, unzip
6+, makeWrapper
7+, icu
8+, libunwind
9+, curl
10+, zlib
11+, libuuid
12+, dotnetbuildhelpers
13+, dotnetCorePackages
14+, coreclr
15+, openssl
16+}:
17+
18+stdenv.mkDerivation rec {
19+ pname = "azure-functions-core-tools";
20+ version = "3.0.3568";
21+
22+ src = fetchurl {
23+ url = "https://github.com/Azure/${pname}/releases/download/${version}/Azure.Functions.Cli.linux-x64.${version}.zip";
24+ sha256 = "0yxdqc5d1xsixjj2dlvs32d6fz4vh58ih2l00lc456fg15mfw3lg";
25+ };
26+
27+ buildInputs = [
28+ unzip
29+ makeWrapper
30+ dotnetbuildhelpers
31+ ];
32+
33+ nativeBuildInputs = [
34+ icu
35+ libunwind
36+ curl
37+ zlib
38+ dotnetCorePackages.sdk_3_1
39+ ];
40+
41+ libPath = lib.makeLibraryPath [
42+ libunwind
43+ libuuid
44+ stdenv.cc.cc
45+ curl
46+ zlib
47+ icu
48+ openssl
49+ ];
50+
51+ unpackPhase = ''
52+ unzip $src
53+ '';
54+
55+ installPhase = ''
56+ mkdir -p $out/bin
57+ cp -prd * $out/bin
58+ patchelf \
59+ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
60+ --set-rpath "${libPath}" "$out/bin/func"
61+ chmod +x $out/bin/func $out/bin/gozip
62+ find $out/bin -type f -name "*.so" -exec patchelf --set-rpath "${libPath}" {} \;
63+ wrapProgram "$out/bin/func" --prefix LD_LIBRARY_PATH : ${libPath}
64+ '';
65+ dontStrip = true; # Causes rpath patching to break if not set
66+
67+ meta = with lib; {
68+ homepage = "https://github.com/Azure/azure-functions-core-tools";
69+ description = "Command line tools for Azure Functions";
70+ license = licenses.mit;
71+ maintainers = with maintainers; [ jshcmpbll ];
72+ platforms = platforms.linux;
73+ };
74+}