buildDotnetModule: make dotnet-runtime optional

This commit is contained in:
David McFarland 2024-10-27 13:40:31 -03:00
parent 193378ead2
commit 4219a94158
3 changed files with 9 additions and 5 deletions

View File

@ -188,7 +188,9 @@ let
# propagate the runtime sandbox profile since the contents apply to published
# executables
propagatedSandboxProfile = toString dotnet-runtime.__propagatedSandboxProfile;
propagatedSandboxProfile = lib.optionalString (dotnet-runtime != null) (
toString dotnet-runtime.__propagatedSandboxProfile
);
meta = (args.meta or { }) // {
inherit platforms;

View File

@ -53,7 +53,7 @@
name = "dotnet-fixup-hook";
substitutions = {
# this is used for DOTNET_ROOT, so we need unwrapped
dotnetRuntime = dotnet-runtime.unwrapped;
dotnetRuntime = if (dotnet-runtime != null) then dotnet-runtime.unwrapped else null;
wrapperPath = lib.makeBinPath [ which coreutils ];
};
}

View File

@ -44,9 +44,11 @@ dotnetFromEnv'
# if dotnet CLI is available, set DOTNET_ROOT based on it. Otherwise set to default .NET runtime
dotnetRootFlagsArray+=("--suffix" "PATH" ":" "$wrapperPath")
dotnetRootFlagsArray+=("--run" "$dotnetFromEnvScript")
dotnetRootFlagsArray+=("--set-default" "DOTNET_ROOT" "$dotnetRuntime/share/dotnet")
dotnetRootFlagsArray+=("--suffix" "PATH" ":" "$dotnetRuntime/bin")
else
if [[ -n $dotnetRuntime ]]; then
dotnetRootFlagsArray+=("--set-default" "DOTNET_ROOT" "$dotnetRuntime/share/dotnet")
dotnetRootFlagsArray+=("--suffix" "PATH" ":" "$dotnetRuntime/bin")
fi
elif [[ -n $dotnetRuntime ]]; then
dotnetRootFlagsArray+=("--set" "DOTNET_ROOT" "$dotnetRuntime/share/dotnet")
dotnetRootFlagsArray+=("--prefix" "PATH" ":" "$dotnetRuntime/bin")
fi