2020-08-20 17:08:02 +00:00
|
|
|
{ type
|
|
|
|
, version
|
|
|
|
, sha512
|
|
|
|
}:
|
|
|
|
|
2021-10-17 09:34:42 +00:00
|
|
|
assert builtins.elem type [ "aspnetcore" "runtime" "sdk"];
|
2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-08-20 17:08:02 +00:00
|
|
|
, fetchurl
|
|
|
|
, libunwind
|
|
|
|
, openssl
|
|
|
|
, icu
|
|
|
|
, libuuid
|
|
|
|
, zlib
|
|
|
|
, curl
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = if type == "aspnetcore" then
|
|
|
|
"aspnetcore-runtime"
|
2021-10-17 09:34:42 +00:00
|
|
|
else if type == "runtime" then
|
2020-08-20 17:08:02 +00:00
|
|
|
"dotnet-runtime"
|
|
|
|
else
|
|
|
|
"dotnet-sdk";
|
|
|
|
platform = if stdenv.isDarwin then "osx" else "linux";
|
|
|
|
suffix = {
|
|
|
|
x86_64-linux = "x64";
|
|
|
|
aarch64-linux = "arm64";
|
|
|
|
x86_64-darwin = "x64";
|
|
|
|
}."${stdenv.hostPlatform.system}" or (throw
|
|
|
|
"Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
urls = {
|
|
|
|
aspnetcore = "https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/${version}/${pname}-${version}-${platform}-${suffix}.tar.gz";
|
2021-10-17 09:34:42 +00:00
|
|
|
runtime = "https://dotnetcli.azureedge.net/dotnet/Runtime/${version}/${pname}-${version}-${platform}-${suffix}.tar.gz";
|
2020-08-20 17:08:02 +00:00
|
|
|
sdk = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${pname}-${version}-${platform}-${suffix}.tar.gz";
|
|
|
|
};
|
|
|
|
descriptions = {
|
2021-10-17 09:34:42 +00:00
|
|
|
aspnetcore = "ASP.NET Core Runtime ${version}";
|
|
|
|
runtime = ".NET Runtime ${version}";
|
2020-08-20 17:08:02 +00:00
|
|
|
sdk = ".NET SDK ${version}";
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
inherit pname version;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
rpath = lib.makeLibraryPath [
|
2020-08-20 17:08:02 +00:00
|
|
|
curl
|
|
|
|
icu
|
|
|
|
libunwind
|
|
|
|
libuuid
|
|
|
|
openssl
|
|
|
|
stdenv.cc.cc
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = builtins.getAttr type urls;
|
|
|
|
sha512 = sha512."${stdenv.hostPlatform.system}" or (throw
|
|
|
|
"Missing hash for host system: ${stdenv.hostPlatform.system}");
|
|
|
|
};
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
dontPatchELF = true;
|
|
|
|
noDumpEnvVars = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -r ./ $out
|
|
|
|
ln -s $out/dotnet $out/bin/dotnet
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
2020-08-20 17:08:02 +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}' {} \;
|
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/dotnet --info
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-08-20 17:08:02 +00:00
|
|
|
homepage = "https://dotnet.github.io/";
|
|
|
|
description = builtins.getAttr type descriptions;
|
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
|
|
|
maintainers = with maintainers; [ kuznero ];
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|