From 612f808fcc2d12bf46545c5d582f8b1e2d46b3eb Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Thu, 30 Dec 2021 18:22:17 +0100 Subject: [PATCH] buildDotnetModule: stop passthru attributes from being overwritten --- .../build-dotnet-module/default.nix | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/pkgs/build-support/build-dotnet-module/default.nix b/pkgs/build-support/build-dotnet-module/default.nix index c8b65f546acc..0a5b17a4a363 100644 --- a/pkgs/build-support/build-dotnet-module/default.nix +++ b/pkgs/build-support/build-dotnet-module/default.nix @@ -117,40 +117,42 @@ let DOTNET_NOLOGO = true; # This disables the welcome message. DOTNET_CLI_TELEMETRY_OPTOUT = true; - passthru.fetch-deps = args.passthru.fetch-deps or writeScript "fetch-${args.pname}-deps" '' - set -euo pipefail - cd "$(dirname "''${BASH_SOURCE[0]}")" + passthru = { + fetch-deps = writeScript "fetch-${args.pname}-deps" '' + set -euo pipefail + cd "$(dirname "''${BASH_SOURCE[0]}")" - export HOME=$(mktemp -d) - deps_file="/tmp/${args.pname}-deps.nix" + export HOME=$(mktemp -d) + deps_file="/tmp/${args.pname}-deps.nix" - store_src="${package.src}" - src="$(mktemp -d /tmp/${args.pname}.XXX)" - cp -rT "$store_src" "$src" - chmod -R +w "$src" + store_src="${package.src}" + src="$(mktemp -d /tmp/${args.pname}.XXX)" + cp -rT "$store_src" "$src" + chmod -R +w "$src" - trap "rm -rf $src $HOME" EXIT - pushd "$src" + trap "rm -rf $src $HOME" EXIT + pushd "$src" - export DOTNET_NOLOGO=1 - export DOTNET_CLI_TELEMETRY_OPTOUT=1 + export DOTNET_NOLOGO=1 + export DOTNET_CLI_TELEMETRY_OPTOUT=1 - mkdir -p "$HOME/nuget_pkgs" + mkdir -p "$HOME/nuget_pkgs" - for project in "${lib.concatStringsSep "\" \"" ((lib.toList projectFile) ++ lib.optionals (testProjectFile != "") (lib.toList testProjectFile))}"; do - ${dotnet-sdk}/bin/dotnet restore "$project" \ - ${lib.optionalString (!enableParallelBuilding) "--disable-parallel"} \ - -p:ContinuousIntegrationBuild=true \ - -p:Deterministic=true \ - --packages "$HOME/nuget_pkgs" \ - "''${dotnetRestoreFlags[@]}" \ - "''${dotnetFlags[@]}" - done + for project in "${lib.concatStringsSep "\" \"" ((lib.toList projectFile) ++ lib.optionals (testProjectFile != "") (lib.toList testProjectFile))}"; do + ${dotnet-sdk}/bin/dotnet restore "$project" \ + ${lib.optionalString (!enableParallelBuilding) "--disable-parallel"} \ + -p:ContinuousIntegrationBuild=true \ + -p:Deterministic=true \ + --packages "$HOME/nuget_pkgs" \ + "''${dotnetRestoreFlags[@]}" \ + "''${dotnetFlags[@]}" + done - echo "Writing lockfile..." - ${nuget-to-nix}/bin/nuget-to-nix "$HOME/nuget_pkgs" > "$deps_file" - echo "Succesfully wrote lockfile to: $deps_file" - ''; + echo "Writing lockfile..." + ${nuget-to-nix}/bin/nuget-to-nix "$HOME/nuget_pkgs" > "$deps_file" + echo "Succesfully wrote lockfile to: $deps_file" + ''; + } // args.passthru or {}; configurePhase = args.configurePhase or '' runHook preConfigure