dotnetCorePackages: Add function to combine SDK packages
Fixup assert Fixup: Move comment to top Fixup combine Fixup combine Fixup buildDotnet Fixup default.nix Fixup combine packages dotnetCorePackages: Fixup combinePackages Co-Authored-By: Jon <jonringer@users.noreply.github.com>
This commit is contained in:
parent
4c58a2d2c7
commit
7fa8332907
66
pkgs/development/compilers/dotnet/buildDotnet.nix
Normal file
66
pkgs/development/compilers/dotnet/buildDotnet.nix
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{ type
|
||||||
|
, version
|
||||||
|
, sha512
|
||||||
|
}:
|
||||||
|
assert builtins.elem type [ "aspnetcore" "netcore" "sdk"];
|
||||||
|
{ stdenv
|
||||||
|
, fetchurl
|
||||||
|
, libunwind
|
||||||
|
, openssl
|
||||||
|
, icu
|
||||||
|
, libuuid
|
||||||
|
, zlib
|
||||||
|
, curl
|
||||||
|
}:
|
||||||
|
let pname = if type == "aspnetcore" then "aspnetcore-runtime" else if type == "netcore" then "dotnet-runtime" else "dotnet-sdk";
|
||||||
|
urls = {
|
||||||
|
aspnetcore = "https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/${version}/${pname}-${version}-linux-x64.tar.gz";
|
||||||
|
netcore = "https://dotnetcli.azureedge.net/dotnet/Runtime/${version}/${pname}-${version}-linux-x64.tar.gz";
|
||||||
|
sdk = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${pname}-${version}-linux-x64.tar.gz";
|
||||||
|
};
|
||||||
|
descriptions = {
|
||||||
|
aspnetcore = "ASP .NET Core runtime ${version}";
|
||||||
|
netcore = ".NET Core runtime ${version}";
|
||||||
|
sdk = ".NET SDK ${version}";
|
||||||
|
};
|
||||||
|
in stdenv.mkDerivation rec {
|
||||||
|
inherit pname version;
|
||||||
|
|
||||||
|
rpath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc libunwind libuuid icu openssl zlib curl ];
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = builtins.getAttr type urls;
|
||||||
|
inherit sha512;
|
||||||
|
};
|
||||||
|
|
||||||
|
sourceRoot = ".";
|
||||||
|
|
||||||
|
dontPatchELF = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp -r ./ $out
|
||||||
|
ln -s $out/dotnet $out/bin/dotnet
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
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}' {} \;
|
||||||
|
'';
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
installCheckPhase = ''
|
||||||
|
$out/bin/dotnet --info
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
homepage = https://dotnet.github.io/;
|
||||||
|
description = builtins.getAttr type descriptions;
|
||||||
|
platforms = [ "x86_64-linux" ];
|
||||||
|
maintainers = with maintainers; [ kuznero ];
|
||||||
|
license = licenses.mit;
|
||||||
|
};
|
||||||
|
}
|
20
pkgs/development/compilers/dotnet/combinePackages.nix
Normal file
20
pkgs/development/compilers/dotnet/combinePackages.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
packages:
|
||||||
|
{ buildEnv, lib }:
|
||||||
|
let cli = builtins.head packages;
|
||||||
|
in
|
||||||
|
assert lib.assertMsg ((builtins.length packages) != 0)
|
||||||
|
''You must include at least one package, e.g
|
||||||
|
`with dotnetCorePackages; combinePackages {
|
||||||
|
packages = [ sdk_3_0 aspnetcore_2_1 ];
|
||||||
|
};`'' ;
|
||||||
|
buildEnv {
|
||||||
|
name = "dotnet-core-combined";
|
||||||
|
paths = packages;
|
||||||
|
pathsToLink = [ "/host" "/packs" "/sdk" "/shared" "/templates" ];
|
||||||
|
ignoreCollisions = true;
|
||||||
|
postBuild = ''
|
||||||
|
cp ${cli}/dotnet $out/dotnet
|
||||||
|
mkdir $out/bin
|
||||||
|
ln -s $out/dotnet $out/bin/
|
||||||
|
'';
|
||||||
|
}
|
18
pkgs/development/compilers/dotnet/default.nix
Normal file
18
pkgs/development/compilers/dotnet/default.nix
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
How to combine packages for use in development:
|
||||||
|
dotnetCombined = with dotnetCorePackages; combinePackages [ sdk_3_1 sdk_2_2 sdk_3_0 sdk aspnetcore_2_1 ];
|
||||||
|
*/
|
||||||
|
{ callPackage }:
|
||||||
|
let
|
||||||
|
buildDotnet = attrs: callPackage (import ./buildDotnet.nix attrs) {};
|
||||||
|
buildAspNetCore = attrs: buildDotnet (attrs // { type = "aspnetcore"; } );
|
||||||
|
buildNetCore = attrs: buildDotnet (attrs // { type = "netcore"; } );
|
||||||
|
buildNetCoreSdk = attrs: buildDotnet (attrs // { type = "sdk"; } );
|
||||||
|
in rec {
|
||||||
|
combinePackages = attrs: callPackage (import ./combinePackages.nix attrs) {};
|
||||||
|
|
||||||
|
sdk_2_2 = buildNetCoreSdk {
|
||||||
|
version = "2.2.401";
|
||||||
|
sha512 = "05w3zk7bcd8sv3k4kplf20j906and2006g1fggq7y6kaxrlhdnpd6jhy6idm8v5bz48wfxga5b4yys9qx0fp3p8yl7wi67qljpzrq88";
|
||||||
|
};
|
||||||
|
}
|
@ -1,54 +0,0 @@
|
|||||||
{ stdenv
|
|
||||||
, fetchurl
|
|
||||||
, libunwind
|
|
||||||
, openssl
|
|
||||||
, icu
|
|
||||||
, libuuid
|
|
||||||
, zlib
|
|
||||||
, curl
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
rpath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc libunwind libuuid icu openssl zlib curl ];
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
version = "2.2.401";
|
|
||||||
netCoreVersion = "2.2.6";
|
|
||||||
pname = "dotnet-sdk";
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${pname}-${version}-linux-x64.tar.gz";
|
|
||||||
# use sha512 from the download page
|
|
||||||
sha512 = "05w3zk7bcd8sv3k4kplf20j906and2006g1fggq7y6kaxrlhdnpd6jhy6idm8v5bz48wfxga5b4yys9qx0fp3p8yl7wi67qljpzrq88";
|
|
||||||
};
|
|
||||||
|
|
||||||
sourceRoot = ".";
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" ./dotnet
|
|
||||||
patchelf --set-rpath "${rpath}" ./dotnet
|
|
||||||
find -type f -name "*.so" -exec patchelf --set-rpath '$ORIGIN:${rpath}' {} \;
|
|
||||||
echo -n "dotnet-sdk version: "
|
|
||||||
./dotnet --version
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
|
|
||||||
dontPatchELF = true;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp -r ./ $out
|
|
||||||
ln -s $out/dotnet $out/bin/dotnet
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
|
||||||
homepage = https://dotnet.github.io/;
|
|
||||||
description = ".NET Core SDK ${version} with .NET Core ${netCoreVersion}";
|
|
||||||
platforms = [ "x86_64-linux" ];
|
|
||||||
maintainers = with maintainers; [ kuznero ];
|
|
||||||
license = licenses.mit;
|
|
||||||
};
|
|
||||||
}
|
|
@ -213,7 +213,9 @@ in
|
|||||||
|
|
||||||
dotnetbuildhelpers = callPackage ../build-support/dotnetbuildhelpers { };
|
dotnetbuildhelpers = callPackage ../build-support/dotnetbuildhelpers { };
|
||||||
|
|
||||||
dotnet-sdk = callPackage ../development/compilers/dotnet/sdk { };
|
dotnetCorePackages = recurseIntoAttrs (callPackage ../development/compilers/dotnet {});
|
||||||
|
|
||||||
|
dotnet-sdk = dotnetCorePackages.sdk_2_2;
|
||||||
|
|
||||||
dumb-init = callPackage ../applications/virtualization/dumb-init {};
|
dumb-init = callPackage ../applications/virtualization/dumb-init {};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user