2020-01-17 13:54:22 +00:00
|
|
|
{ type
|
|
|
|
, version
|
|
|
|
, sha512
|
|
|
|
}:
|
2020-07-16 21:02:04 +00:00
|
|
|
|
2021-09-26 21:06:38 +00:00
|
|
|
assert builtins.elem type [ "aspnetcore" "runtime" "sdk"];
|
2021-01-22 11:25:31 +00:00
|
|
|
{ lib, stdenv
|
2020-01-17 13:54:22 +00:00
|
|
|
, fetchurl
|
|
|
|
, libunwind
|
|
|
|
, openssl
|
|
|
|
, icu
|
|
|
|
, libuuid
|
|
|
|
, zlib
|
|
|
|
, curl
|
2020-07-16 21:02:04 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2020-07-16 21:23:49 +00:00
|
|
|
pname = if type == "aspnetcore" then
|
|
|
|
"aspnetcore-runtime"
|
2021-09-26 21:06:38 +00:00
|
|
|
else if type == "runtime" then
|
2020-07-16 21:23:49 +00:00
|
|
|
"dotnet-runtime"
|
|
|
|
else
|
|
|
|
"dotnet-sdk";
|
2021-09-23 18:01:18 +00:00
|
|
|
platform = {
|
|
|
|
x86_64-linux = "linux-x64";
|
|
|
|
aarch64-linux = "linux-arm64";
|
|
|
|
x86_64-darwin = "osx-x64";
|
|
|
|
aarch64-darwin = "osx-arm64";
|
|
|
|
}.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
|
2020-07-16 21:02:04 +00:00
|
|
|
urls = {
|
2021-09-23 18:01:18 +00:00
|
|
|
aspnetcore = "https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/${version}/${pname}-${version}-${platform}.tar.gz";
|
|
|
|
runtime = "https://dotnetcli.azureedge.net/dotnet/Runtime/${version}/${pname}-${version}-${platform}.tar.gz";
|
|
|
|
sdk = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${pname}-${version}-${platform}.tar.gz";
|
2020-07-16 21:02:04 +00:00
|
|
|
};
|
|
|
|
descriptions = {
|
2021-09-26 21:06:38 +00:00
|
|
|
aspnetcore = "ASP.NET Core Runtime ${version}";
|
|
|
|
runtime = ".NET Runtime ${version}";
|
2020-07-16 21:02:04 +00:00
|
|
|
sdk = ".NET SDK ${version}";
|
|
|
|
};
|
2020-01-17 13:54:22 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2020-07-16 21:02:04 +00:00
|
|
|
inherit pname version;
|
2020-01-17 13:54:22 +00:00
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
rpath = lib.makeLibraryPath [
|
2020-07-16 21:23:49 +00:00
|
|
|
curl
|
|
|
|
icu
|
|
|
|
libunwind
|
|
|
|
libuuid
|
|
|
|
openssl
|
|
|
|
stdenv.cc.cc
|
|
|
|
zlib
|
|
|
|
];
|
2020-01-17 13:54:22 +00:00
|
|
|
|
2020-07-16 21:02:04 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = builtins.getAttr type urls;
|
2020-07-16 21:23:49 +00:00
|
|
|
sha512 = sha512."${stdenv.hostPlatform.system}" or (throw
|
|
|
|
"Missing hash for host system: ${stdenv.hostPlatform.system}");
|
2020-07-16 21:02:04 +00:00
|
|
|
};
|
2020-01-17 13:54:22 +00:00
|
|
|
|
2020-07-16 21:02:04 +00:00
|
|
|
sourceRoot = ".";
|
2020-01-17 13:54:22 +00:00
|
|
|
|
2020-07-16 21:02:04 +00:00
|
|
|
dontPatchELF = true;
|
|
|
|
noDumpEnvVars = true;
|
2020-01-17 13:54:22 +00:00
|
|
|
|
2020-07-16 21:02:04 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -r ./ $out
|
|
|
|
ln -s $out/dotnet $out/bin/dotnet
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2020-01-17 13:54:22 +00:00
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
2020-07-16 21:02:04 +00:00
|
|
|
patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $out/dotnet
|
|
|
|
patchelf --set-rpath "${rpath}" $out/dotnet
|
|
|
|
find $out -type f -name "*.so" -exec patchelf --set-rpath '$ORIGIN:${rpath}' {} \;
|
|
|
|
find $out -type f -name "apphost" -exec patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" --set-rpath '$ORIGIN:${rpath}' {} \;
|
|
|
|
'';
|
2020-01-17 13:54:22 +00:00
|
|
|
|
2020-07-16 21:02:04 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/dotnet --info
|
|
|
|
'';
|
2020-01-17 13:54:22 +00:00
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-07-16 21:02:04 +00:00
|
|
|
homepage = "https://dotnet.github.io/";
|
|
|
|
description = builtins.getAttr type descriptions;
|
2021-09-23 18:01:18 +00:00
|
|
|
platforms = builtins.attrNames sha512;
|
2020-07-16 21:02:04 +00:00
|
|
|
maintainers = with maintainers; [ kuznero ];
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
2020-01-17 13:54:22 +00:00
|
|
|
}
|