2020-08-20 17:08:02 +00:00
|
|
|
{ type
|
|
|
|
, version
|
2022-03-30 09:31:56 +00:00
|
|
|
, srcs
|
2022-08-21 13:32:41 +00:00
|
|
|
, packages ? null
|
2020-08-20 17:08:02 +00:00
|
|
|
}:
|
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
assert builtins.elem type [ "aspnetcore" "runtime" "sdk" ];
|
2022-08-21 13:32:41 +00:00
|
|
|
assert if type == "sdk" then packages != null else true;
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-08-20 17:08:02 +00:00
|
|
|
, fetchurl
|
2022-03-30 09:31:56 +00:00
|
|
|
, writeText
|
2022-07-18 16:21:45 +00:00
|
|
|
, autoPatchelfHook
|
|
|
|
, makeWrapper
|
2020-08-20 17:08:02 +00:00
|
|
|
, libunwind
|
2023-03-30 22:05:00 +00:00
|
|
|
, icu
|
2020-08-20 17:08:02 +00:00
|
|
|
, libuuid
|
|
|
|
, zlib
|
2022-09-22 12:36:57 +00:00
|
|
|
, libkrb5
|
2020-08-20 17:08:02 +00:00
|
|
|
, curl
|
2021-12-19 01:06:50 +00:00
|
|
|
, lttng-ust_2_12
|
2022-09-22 12:36:57 +00:00
|
|
|
, testers
|
|
|
|
, runCommand
|
2022-09-30 11:47:45 +00:00
|
|
|
, writeShellScript
|
2022-12-28 21:21:41 +00:00
|
|
|
, mkNugetDeps
|
2024-04-21 15:54:59 +00:00
|
|
|
, callPackage
|
2020-08-20 17:08:02 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-07-18 16:21:45 +00:00
|
|
|
pname =
|
|
|
|
if type == "aspnetcore" then
|
|
|
|
"aspnetcore-runtime"
|
|
|
|
else if type == "runtime" then
|
|
|
|
"dotnet-runtime"
|
|
|
|
else
|
|
|
|
"dotnet-sdk";
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
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}";
|
|
|
|
};
|
2022-12-28 21:21:41 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
mkCommon = callPackage ./common.nix {};
|
2022-12-28 21:21:41 +00:00
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
in
|
2024-04-21 15:54:59 +00:00
|
|
|
mkCommon type rec {
|
2020-08-20 17:08:02 +00:00
|
|
|
inherit pname version;
|
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
# Some of these dependencies are `dlopen()`ed.
|
2022-07-18 16:21:45 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
] ++ lib.optional stdenv.isLinux autoPatchelfHook;
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
stdenv.cc.cc
|
2022-09-22 12:36:57 +00:00
|
|
|
zlib
|
|
|
|
icu
|
|
|
|
libkrb5
|
|
|
|
curl
|
|
|
|
] ++ lib.optional stdenv.isLinux lttng-ust_2_12;
|
2022-07-18 16:21:45 +00:00
|
|
|
|
|
|
|
src = fetchurl (
|
|
|
|
srcs."${stdenv.hostPlatform.system}" or (throw
|
|
|
|
"Missing source (url and hash) for host system: ${stdenv.hostPlatform.system}")
|
|
|
|
);
|
2020-08-20 17:08:02 +00:00
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
dontPatchELF = true;
|
|
|
|
noDumpEnvVars = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2022-10-06 18:32:54 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -r ./ $out
|
2022-10-06 18:32:54 +00: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-08-20 17:08:02 +00:00
|
|
|
ln -s $out/dotnet $out/bin/dotnet
|
2022-10-06 18:32:54 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2022-09-22 12:36:57 +00:00
|
|
|
# Tell autoPatchelf about runtime dependencies.
|
|
|
|
# (postFixup phase is run before autoPatchelfHook.)
|
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
|
|
|
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 \
|
|
|
|
$out/packs/Microsoft.NETCore.App.Host.linux-x64/*/runtimes/linux-x64/native/singlefilehost
|
|
|
|
patchelf \
|
|
|
|
--add-needed libgssapi_krb5.so \
|
|
|
|
$out/shared/Microsoft.NETCore.App/*/*System.Net.Security.Native.so \
|
|
|
|
$out/packs/Microsoft.NETCore.App.Host.linux-x64/*/runtimes/linux-x64/native/singlefilehost
|
|
|
|
patchelf \
|
|
|
|
--add-needed libssl.so \
|
|
|
|
$out/shared/Microsoft.NETCore.App/*/*System.Security.Cryptography.Native.OpenSsl.so \
|
|
|
|
$out/packs/Microsoft.NETCore.App.Host.linux-x64/*/runtimes/linux-x64/native/singlefilehost
|
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru = {
|
2022-12-28 21:21:41 +00:00
|
|
|
inherit icu;
|
2024-04-21 15:54:59 +00:00
|
|
|
} // lib.optionalAttrs (type == "sdk") {
|
|
|
|
packages = mkNugetDeps {
|
|
|
|
name = "${pname}-${version}-deps";
|
|
|
|
nugetDeps = packages;
|
|
|
|
};
|
2022-09-14 18:05:37 +00:00
|
|
|
|
2022-09-30 11:47:45 +00: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-22 12:36:57 +00:00
|
|
|
'';
|
2022-07-18 16:21:45 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-08-20 17:08:02 +00:00
|
|
|
description = builtins.getAttr type descriptions;
|
2022-05-18 14:49:53 +00:00
|
|
|
homepage = "https://dotnet.github.io/";
|
2020-08-20 17:08:02 +00:00
|
|
|
license = licenses.mit;
|
2022-06-16 17:23:12 +00:00
|
|
|
maintainers = with maintainers; [ kuznero mdarocha ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "dotnet";
|
2022-09-22 12:36:57 +00:00
|
|
|
platforms = attrNames srcs;
|
2020-08-20 17:08:02 +00:00
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
}
|