From f69de108fbc7f205b68bdad693efa8bd361c8635 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 25 Apr 2022 18:18:50 +0200 Subject: [PATCH] buildDotnetModule: nuget source cleanup There used to be a few issues with the way we generate the nuget source: * The derivation generated for the deps would have "nuget-deps" in them twice: /nix/store/...-foo-1.0-nuget-deps-nuget-deps * We always tried to generate the dependencies for "projectReferences" even when it wasn't set, causing a warning. This fixes those issues :) --- .../dotnet/build-dotnet-module/default.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix index b5651d72a920..6e7388a4a75e 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix @@ -74,13 +74,16 @@ let inherit dotnet-sdk dotnet-test-sdk disabledTests nuget-source dotnet-runtime runtimeDeps buildType; }) dotnetConfigureHook dotnetBuildHook dotnetCheckHook dotnetInstallHook dotnetFixupHook; - _nugetDeps = mkNugetDeps { name = "${name}-nuget-deps"; nugetDeps = import nugetDeps; }; - _localDeps = linkFarmFromDrvs "${name}-local-nuget-deps" projectReferences; + localDeps = if (projectReferences != []) + then linkFarmFromDrvs "${name}-project-references" projectReferences + else null; + + _nugetDeps = mkNugetDeps { inherit name; nugetDeps = import nugetDeps; }; nuget-source = mkNugetSource { - name = "${args.pname}-nuget-source"; - description = "A Nuget source with the dependencies for ${args.pname}"; - deps = [ _nugetDeps _localDeps ]; + name = "${name}-nuget-source"; + description = "A Nuget source with the dependencies for ${name}"; + deps = [ _nugetDeps ] ++ lib.optional (localDeps != null) localDeps; }; in stdenvNoCC.mkDerivation (args // { @@ -103,6 +106,8 @@ in stdenvNoCC.mkDerivation (args // { dontWrapGApps = args.dontWrapGApps or true; passthru = { + inherit nuget-source; + fetch-deps = writeScript "fetch-${pname}-deps" '' set -euo pipefail cd "$(dirname "''${BASH_SOURCE[0]}")"