2020-01-17 14:54:22 +01:00
|
|
|
{ type
|
|
|
|
, version
|
2022-03-14 12:49:47 +01:00
|
|
|
, srcs
|
2022-07-15 16:53:58 +02:00
|
|
|
, packages ? null
|
2020-01-17 14:54:22 +01:00
|
|
|
}:
|
2020-07-16 14:02:04 -07:00
|
|
|
|
2022-05-19 03:41:08 +02:00
|
|
|
assert builtins.elem type [ "aspnetcore" "runtime" "sdk" ];
|
2022-07-15 16:53:58 +02:00
|
|
|
assert if type == "sdk" then packages != null else true;
|
2022-03-04 14:08:44 +01:00
|
|
|
|
2021-12-18 16:29:54 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-01-17 14:54:22 +01:00
|
|
|
, fetchurl
|
2022-03-04 14:08:44 +01:00
|
|
|
, writeText
|
2022-05-19 03:41:08 +02:00
|
|
|
, autoPatchelfHook
|
|
|
|
, makeWrapper
|
2020-01-17 14:54:22 +01:00
|
|
|
, libunwind
|
2023-03-21 22:27:19 +01:00
|
|
|
, icu
|
2020-01-17 14:54:22 +01:00
|
|
|
, libuuid
|
|
|
|
, zlib
|
2022-09-08 15:48:42 -03:00
|
|
|
, libkrb5
|
2020-01-17 14:54:22 +01:00
|
|
|
, curl
|
2021-04-05 16:01:43 +00:00
|
|
|
, lttng-ust_2_12
|
2022-09-09 07:18:26 -03:00
|
|
|
, testers
|
|
|
|
, runCommand
|
2022-09-19 22:13:11 +02:00
|
|
|
, writeShellScript
|
2022-09-30 16:02:32 -03:00
|
|
|
, mkNugetDeps
|
2024-02-20 23:21:08 -04:00
|
|
|
, callPackage
|
2024-04-17 09:41:51 -03:00
|
|
|
, dotnetCorePackages
|
2020-07-16 14:02:04 -07:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-05-19 03:41:08 +02:00
|
|
|
pname =
|
|
|
|
if type == "aspnetcore" then
|
|
|
|
"aspnetcore-runtime"
|
|
|
|
else if type == "runtime" then
|
|
|
|
"dotnet-runtime"
|
|
|
|
else
|
|
|
|
"dotnet-sdk";
|
2022-03-14 12:49:47 +01:00
|
|
|
|
2020-07-16 14:02:04 -07:00
|
|
|
descriptions = {
|
2021-09-26 23:06:38 +02:00
|
|
|
aspnetcore = "ASP.NET Core Runtime ${version}";
|
|
|
|
runtime = ".NET Runtime ${version}";
|
2020-07-16 14:02:04 -07:00
|
|
|
sdk = ".NET SDK ${version}";
|
|
|
|
};
|
2022-09-30 16:02:32 -03:00
|
|
|
|
2024-02-20 23:21:08 -04:00
|
|
|
mkCommon = callPackage ./common.nix {};
|
2022-09-30 16:02:32 -03:00
|
|
|
|
2024-04-17 09:41:51 -03:00
|
|
|
targetRid = dotnetCorePackages.systemToDotnetRid stdenv.targetPlatform.system;
|
|
|
|
|
2022-05-19 03:41:08 +02:00
|
|
|
in
|
2024-02-20 23:21:08 -04:00
|
|
|
mkCommon type rec {
|
2020-07-16 14:02:04 -07:00
|
|
|
inherit pname version;
|
2020-01-17 14:54:22 +01:00
|
|
|
|
2021-04-05 16:01:43 +00:00
|
|
|
# Some of these dependencies are `dlopen()`ed.
|
2022-05-19 03:41:08 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
2022-07-17 13:34:29 -07:00
|
|
|
] ++ lib.optional stdenv.isLinux autoPatchelfHook;
|
2022-05-19 03:41:08 +02:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
stdenv.cc.cc
|
2022-09-08 15:48:42 -03:00
|
|
|
zlib
|
|
|
|
icu
|
|
|
|
libkrb5
|
|
|
|
curl
|
|
|
|
] ++ lib.optional stdenv.isLinux lttng-ust_2_12;
|
2022-05-19 03:41:08 +02:00
|
|
|
|
|
|
|
src = fetchurl (
|
|
|
|
srcs."${stdenv.hostPlatform.system}" or (throw
|
|
|
|
"Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}")
|
|
|
|
);
|
2020-01-17 14:54:22 +01:00
|
|
|
|
2020-07-16 14:02:04 -07:00
|
|
|
sourceRoot = ".";
|
2020-01-17 14:54:22 +01:00
|
|
|
|
2020-07-16 14:02:04 -07:00
|
|
|
dontPatchELF = true;
|
|
|
|
noDumpEnvVars = true;
|
2020-01-17 14:54:22 +01:00
|
|
|
|
2020-07-16 14:02:04 -07:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2022-10-02 15:03:34 +02:00
|
|
|
|
2020-07-16 14:02:04 -07:00
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -r ./ $out
|
2022-10-02 15:03:34 +02:00
|
|
|
|
|
|
|
mkdir -p $out/share/doc/$pname/$version
|
|
|
|
mv $out/LICENSE.txt $out/share/doc/$pname/$version/
|
|
|
|
mv $out/ThirdPartyNotices.txt $out/share/doc/$pname/$version/
|
|
|
|
|
2020-07-16 14:02:04 -07:00
|
|
|
ln -s $out/dotnet $out/bin/dotnet
|
2022-10-02 15:03:34 +02:00
|
|
|
|
2020-07-16 14:02:04 -07:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2020-01-17 14:54:22 +01:00
|
|
|
|
2022-09-08 15:48:42 -03:00
|
|
|
# Tell autoPatchelf about runtime dependencies.
|
|
|
|
# (postFixup phase is run before autoPatchelfHook.)
|
2024-04-17 09:41:51 -03:00
|
|
|
postFixup = lib.optionalString stdenv.targetPlatform.isLinux ''
|
2022-09-08 15:48:42 -03:00
|
|
|
patchelf \
|
|
|
|
--add-needed libicui18n.so \
|
|
|
|
--add-needed libicuuc.so \
|
|
|
|
$out/shared/Microsoft.NETCore.App/*/libcoreclr.so \
|
|
|
|
$out/shared/Microsoft.NETCore.App/*/*System.Globalization.Native.so \
|
2024-04-17 09:41:51 -03:00
|
|
|
$out/packs/Microsoft.NETCore.App.Host.${targetRid}/*/runtimes/${targetRid}/native/*host
|
2022-09-08 15:48:42 -03:00
|
|
|
patchelf \
|
|
|
|
--add-needed libgssapi_krb5.so \
|
|
|
|
$out/shared/Microsoft.NETCore.App/*/*System.Net.Security.Native.so \
|
2024-04-17 09:41:51 -03:00
|
|
|
$out/packs/Microsoft.NETCore.App.Host.${targetRid}/*/runtimes/${targetRid}/native/*host
|
2022-09-08 15:48:42 -03:00
|
|
|
patchelf \
|
|
|
|
--add-needed libssl.so \
|
|
|
|
$out/shared/Microsoft.NETCore.App/*/*System.Security.Cryptography.Native.OpenSsl.so \
|
2024-04-17 09:41:51 -03:00
|
|
|
$out/packs/Microsoft.NETCore.App.Host.${targetRid}/*/runtimes/${targetRid}/native/*host
|
2022-09-08 15:48:42 -03:00
|
|
|
'';
|
|
|
|
|
2023-06-21 17:06:26 +02:00
|
|
|
passthru = {
|
2022-09-30 16:02:32 -03:00
|
|
|
inherit icu;
|
2024-02-20 23:21:08 -04:00
|
|
|
} // lib.optionalAttrs (type == "sdk") {
|
|
|
|
packages = mkNugetDeps {
|
|
|
|
name = "${pname}-${version}-deps";
|
|
|
|
nugetDeps = packages;
|
|
|
|
};
|
2022-09-07 22:53:07 +02:00
|
|
|
|
2022-09-19 22:13:11 +02:00
|
|
|
updateScript =
|
|
|
|
let
|
|
|
|
majorVersion =
|
|
|
|
with lib;
|
|
|
|
concatStringsSep "." (take 2 (splitVersion version));
|
|
|
|
in
|
|
|
|
writeShellScript "update-dotnet-${majorVersion}" ''
|
|
|
|
pushd pkgs/development/compilers/dotnet
|
|
|
|
exec ${./update.sh} "${majorVersion}"
|
2022-09-09 07:18:26 -03:00
|
|
|
'';
|
2022-05-19 03:41:08 +02:00
|
|
|
};
|
|
|
|
|
2021-01-22 18:25:31 +07:00
|
|
|
meta = with lib; {
|
2020-07-16 14:02:04 -07:00
|
|
|
description = builtins.getAttr type descriptions;
|
2022-05-04 17:46:39 -07:00
|
|
|
homepage = "https://dotnet.github.io/";
|
2020-07-16 14:02:04 -07:00
|
|
|
license = licenses.mit;
|
2022-05-15 10:54:10 +02:00
|
|
|
maintainers = with maintainers; [ kuznero mdarocha ];
|
2022-05-04 17:46:39 -07:00
|
|
|
mainProgram = "dotnet";
|
2022-09-15 19:40:42 -03:00
|
|
|
platforms = attrNames srcs;
|
2020-07-16 14:02:04 -07:00
|
|
|
};
|
2024-02-20 23:21:08 -04:00
|
|
|
}
|