From 328fe3216125218e023bbff3136ef22918bcb8f6 Mon Sep 17 00:00:00 2001 From: mdarocha Date: Mon, 19 Sep 2022 22:13:11 +0200 Subject: [PATCH] dotnet-sdk: add updateScript This update script calls the existing update.sh script with the proper arguments. If not an SDK package, run a dummy script which allows the update.nix script to work properly. This should allow dotnet to be update automatically. --- .../compilers/dotnet/build-dotnet.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkgs/development/compilers/dotnet/build-dotnet.nix b/pkgs/development/compilers/dotnet/build-dotnet.nix index 75d1be9deede..b61adce0ad1d 100644 --- a/pkgs/development/compilers/dotnet/build-dotnet.nix +++ b/pkgs/development/compilers/dotnet/build-dotnet.nix @@ -23,6 +23,7 @@ assert if type == "sdk" then packages != null else true; , lttng-ust_2_12 , testers , runCommand +, writeShellScript }: let @@ -121,6 +122,24 @@ stdenv.mkDerivation (finalAttrs: rec { "aarch64-darwin" = "osx-arm64"; }; + updateScript = + if type != "sdk" then + lib.warn "${pname}-${version}: only the SDK package can be updated - this script will do nothing!" + writeShellScript "dummy-update" '' + echo "Doing nothing..." + echo "Run the updateScript from the SDK package" + '' + else + let + majorVersion = + with lib; + concatStringsSep "." (take 2 (splitVersion version)); + in + writeShellScript "update-dotnet-${majorVersion}" '' + pushd pkgs/development/compilers/dotnet + exec ${./update.sh} "${majorVersion}" + ''; + # Convert a "stdenv.hostPlatform.system" to a dotnet RID systemToDotnetRid = system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}");