about summary refs log tree commit diff
path: root/pkgs/build-support/dotnet
diff options
context:
space:
mode:
authorIvar Scholten <ivar.scholten@protonmail.com>2022-09-09 01:01:14 +0200
committerIvar Scholten <ivar.scholten@protonmail.com>2022-09-18 18:00:37 +0200
commit8e00d6ac269e87705141f817f619d82cf45b6e24 (patch)
treedc6ba63507adb14a81741b4550cd3eef681005fa /pkgs/build-support/dotnet
parent03a1b62cb38cf6a60c496c896dbdccd4e4d9b03a (diff)
buildDotnetModule: move nugetDeps throw to when its actually needed
Previously we had an assert that would complain when nugetDeps wasnt set,
which also didnt allow any passthru attributes (like fetch-deps) to be
build. That causes a cycle where you need nugetDeps to fetch the nuget
deps, but arent able to build the script to do so.
Diffstat (limited to 'pkgs/build-support/dotnet')
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/default.nix22
1 files changed, 10 insertions, 12 deletions
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix
index 569ad2615e67c..41f3271f10cc1 100644
--- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix
+++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix
@@ -82,10 +82,6 @@
 , ...
 } @ args:
 
-# TODO: Automatically generate a dependency file when a lockfile is present.
-# This file is unfortunately almost never present, as Microsoft recommands not to push this in upstream repositories.
-assert nugetDeps == null -> throw "Defining the `nugetDeps` attribute is required, as to lock the NuGet dependencies. This file can be generated by running the `passthru.fetch-deps` script.";
-
 let
   inherit (callPackage ./hooks {
     inherit dotnet-sdk dotnet-test-sdk disabledTests nuget-source dotnet-runtime runtimeDeps buildType;
@@ -97,12 +93,14 @@ let
     else null;
 
   _nugetDeps =
-    if lib.isDerivation nugetDeps
-    then nugetDeps
-    else mkNugetDeps { inherit name; nugetDeps = import nugetDeps; };
+    if (nugetDeps != null) then
+      if lib.isDerivation nugetDeps
+      then nugetDeps
+      else mkNugetDeps { inherit name; nugetDeps = import nugetDeps; }
+    else throw "Defining the `nugetDeps` attribute is required, as to lock the NuGet dependencies. This file can be generated by running the `passthru.fetch-deps` script.";
 
   # contains the actual package dependencies
-  _dependenciesSource = mkNugetSource {
+  dependenciesSource = mkNugetSource {
     name = "${name}-dependencies-source";
     description = "A Nuget source with the dependencies for ${name}";
     deps = [ _nugetDeps ] ++ lib.optional (localDeps != null) localDeps;
@@ -111,19 +109,19 @@ let
   # this contains all the nuget packages that are implictly referenced by the dotnet
   # build system. having them as separate deps allows us to avoid having to regenerate
   # a packages dependencies when the dotnet-sdk version changes
-  _sdkDeps = mkNugetDeps {
+  sdkDeps = mkNugetDeps {
     name = "dotnet-sdk-${dotnet-sdk.version}-deps";
     nugetDeps = dotnet-sdk.passthru.packages;
   };
 
-  _sdkSource = mkNugetSource {
+  sdkSource = mkNugetSource {
     name = "dotnet-sdk-${dotnet-sdk.version}-source";
-    deps = [ _sdkDeps ];
+    deps = [ sdkDeps ];
   };
 
   nuget-source = symlinkJoin {
     name = "${name}-nuget-source";
-    paths = [ _dependenciesSource _sdkSource ];
+    paths = [ dependenciesSource sdkSource ];
   };
 in
 stdenvNoCC.mkDerivation (args // {