From 4c861dd26c1681fdd4fbcf4d31b5652695086c73 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Sat, 24 Sep 2022 08:07:57 -0300 Subject: [PATCH] build-dotnet-module: add useAppHost parameter so it can be disabled --- pkgs/build-support/dotnet/build-dotnet-module/default.nix | 4 ++++ .../dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh | 5 ++++- .../dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix index 4ca6ca0f2470..17a82677c148 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix @@ -71,6 +71,8 @@ , buildType ? "Release" # If set to true, builds the application as a self-contained - removing the runtime dependency on dotnet , selfContainedBuild ? false + # Whether to explicitly enable UseAppHost when building +, useAppHost ? true # The dotnet SDK to use. , dotnet-sdk ? dotnetCorePackages.sdk_6_0 # The dotnet runtime to use. @@ -147,6 +149,8 @@ stdenvNoCC.mkDerivation (args // { # gappsWrapperArgs gets included when wrapping for dotnet, as to avoid double wrapping dontWrapGApps = args.dontWrapGApps or true; + inherit selfContainedBuild useAppHost; + passthru = { inherit nuget-source; diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh index 9199b8d02a81..782c170b0bb1 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-build-hook.sh @@ -20,6 +20,10 @@ dotnetBuildHook() { dotnetBuildFlags+=("-p:SelfContained=false") fi + if [ "${useAppHost-}" ]; then + dotnetBuildFlags+=("-p:UseAppHost=true") + fi + if [ "${version-}" ]; then local -r versionFlag="-p:Version=${version-}" fi @@ -31,7 +35,6 @@ dotnetBuildHook() { -p:BuildInParallel=$parallelBuildFlag \ -p:ContinuousIntegrationBuild=true \ -p:Deterministic=true \ - -p:UseAppHost=true \ --configuration "@buildType@" \ --no-restore \ ${versionFlag-} \ diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh index 217e79e41b46..196d2ca1af7a 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh @@ -12,6 +12,10 @@ dotnetInstallHook() { dotnetInstallFlags+=("--no-self-contained") fi + if [ "${useAppHost-}" ]; then + dotnetInstallFlags+=("-p:UseAppHost=true") + fi + dotnetPublish() { local -r project="${1-}" env dotnet publish ${project-} \