From eea3dedaf462ebb32775167f4206a5b4e6f9e673 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Thu, 16 Jul 2020 14:07:25 -0700 Subject: dotnetCorePackages: rename files --- pkgs/development/compilers/dotnet/build-dotnet.nix | 77 ++++++++++++++++++++++ pkgs/development/compilers/dotnet/buildDotnet.nix | 77 ---------------------- .../compilers/dotnet/combine-packages.nix | 20 ++++++ .../compilers/dotnet/combinePackages.nix | 20 ------ pkgs/development/compilers/dotnet/default.nix | 4 +- 5 files changed, 99 insertions(+), 99 deletions(-) create mode 100644 pkgs/development/compilers/dotnet/build-dotnet.nix delete mode 100644 pkgs/development/compilers/dotnet/buildDotnet.nix create mode 100644 pkgs/development/compilers/dotnet/combine-packages.nix delete mode 100644 pkgs/development/compilers/dotnet/combinePackages.nix (limited to 'pkgs') diff --git a/pkgs/development/compilers/dotnet/build-dotnet.nix b/pkgs/development/compilers/dotnet/build-dotnet.nix new file mode 100644 index 00000000000..1b3d7f10f21 --- /dev/null +++ b/pkgs/development/compilers/dotnet/build-dotnet.nix @@ -0,0 +1,77 @@ +{ 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"; + 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"; + netcore = "https://dotnetcli.azureedge.net/dotnet/Runtime/${version}/${pname}-${version}-${platform}-${suffix}.tar.gz"; + sdk = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${pname}-${version}-${platform}-${suffix}.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; + 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 + ''; + + postFixup = stdenv.lib.optionalString stdenv.isLinux '' + 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 + ''; + + meta = with stdenv.lib; { + 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; + }; +} diff --git a/pkgs/development/compilers/dotnet/buildDotnet.nix b/pkgs/development/compilers/dotnet/buildDotnet.nix deleted file mode 100644 index 1b3d7f10f21..00000000000 --- a/pkgs/development/compilers/dotnet/buildDotnet.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ 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"; - 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"; - netcore = "https://dotnetcli.azureedge.net/dotnet/Runtime/${version}/${pname}-${version}-${platform}-${suffix}.tar.gz"; - sdk = "https://dotnetcli.azureedge.net/dotnet/Sdk/${version}/${pname}-${version}-${platform}-${suffix}.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; - 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 - ''; - - postFixup = stdenv.lib.optionalString stdenv.isLinux '' - 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 - ''; - - meta = with stdenv.lib; { - 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; - }; -} diff --git a/pkgs/development/compilers/dotnet/combine-packages.nix b/pkgs/development/compilers/dotnet/combine-packages.nix new file mode 100644 index 00000000000..00fb7c6d9b4 --- /dev/null +++ b/pkgs/development/compilers/dotnet/combine-packages.nix @@ -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/ + ''; + } diff --git a/pkgs/development/compilers/dotnet/combinePackages.nix b/pkgs/development/compilers/dotnet/combinePackages.nix deleted file mode 100644 index 00fb7c6d9b4..00000000000 --- a/pkgs/development/compilers/dotnet/combinePackages.nix +++ /dev/null @@ -1,20 +0,0 @@ -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/ - ''; - } diff --git a/pkgs/development/compilers/dotnet/default.nix b/pkgs/development/compilers/dotnet/default.nix index b14c7b40f7e..e04f7a03f94 100644 --- a/pkgs/development/compilers/dotnet/default.nix +++ b/pkgs/development/compilers/dotnet/default.nix @@ -4,13 +4,13 @@ dotnetCombined = with dotnetCorePackages; combinePackages [ sdk_3_1 sdk_2_2 sdk_ */ { callPackage }: let - buildDotnet = attrs: callPackage (import ./buildDotnet.nix attrs) {}; + buildDotnet = attrs: callPackage (import ./build-dotnet.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) {}; + combinePackages = attrs: callPackage (import ./combine-packages.nix attrs) {}; # v2.1.15 (LTS) -- cgit 1.4.1