summary refs log tree commit diff
path: root/pkgs/development/compilers/dotnet/buildDotnet.nix
diff options
context:
space:
mode:
authorHerman Fries <baracoder@googlemail.com>2020-01-17 14:54:22 +0100
committerJon <jonringer@users.noreply.github.com>2020-01-17 11:42:11 -0800
commit7fa8332907c83282adb45384b38ffcf0e6fa8da4 (patch)
treee8c3766151795a7c1ec5d67306ebd8d7ca303379 /pkgs/development/compilers/dotnet/buildDotnet.nix
parent4c58a2d2c7e850fbde1fd21d26ecb34e9d9edc0f (diff)
downloadnixpkgs-7fa8332907c83282adb45384b38ffcf0e6fa8da4.tar
nixpkgs-7fa8332907c83282adb45384b38ffcf0e6fa8da4.tar.gz
nixpkgs-7fa8332907c83282adb45384b38ffcf0e6fa8da4.tar.bz2
nixpkgs-7fa8332907c83282adb45384b38ffcf0e6fa8da4.tar.lz
nixpkgs-7fa8332907c83282adb45384b38ffcf0e6fa8da4.tar.xz
nixpkgs-7fa8332907c83282adb45384b38ffcf0e6fa8da4.tar.zst
nixpkgs-7fa8332907c83282adb45384b38ffcf0e6fa8da4.zip
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>
Diffstat (limited to 'pkgs/development/compilers/dotnet/buildDotnet.nix')
-rw-r--r--pkgs/development/compilers/dotnet/buildDotnet.nix66
1 files changed, 66 insertions, 0 deletions
diff --git a/pkgs/development/compilers/dotnet/buildDotnet.nix b/pkgs/development/compilers/dotnet/buildDotnet.nix
new file mode 100644
index 00000000000..0c2222c4c83
--- /dev/null
+++ b/pkgs/development/compilers/dotnet/buildDotnet.nix
@@ -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;
+    };
+}