about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2024-01-18 09:22:38 +0100
committerGitHub <noreply@github.com>2024-01-18 09:22:38 +0100
commitb0fb3f62d04be2d827bbe21135d97ff49c47a0e4 (patch)
tree02826723fbde4c784b4a7e4951563c96cfb49f37 /pkgs/build-support
parent0fc2832905918fa50dbd2e8514f9f2f171f25e8f (diff)
parent928d66083e5bae2f4d2ef622a2d53b3ac8760297 (diff)
downloadnixlib-b0fb3f62d04be2d827bbe21135d97ff49c47a0e4.tar
nixlib-b0fb3f62d04be2d827bbe21135d97ff49c47a0e4.tar.gz
nixlib-b0fb3f62d04be2d827bbe21135d97ff49c47a0e4.tar.bz2
nixlib-b0fb3f62d04be2d827bbe21135d97ff49c47a0e4.tar.lz
nixlib-b0fb3f62d04be2d827bbe21135d97ff49c47a0e4.tar.xz
nixlib-b0fb3f62d04be2d827bbe21135d97ff49c47a0e4.tar.zst
nixlib-b0fb3f62d04be2d827bbe21135d97ff49c47a0e4.zip
Merge pull request #278242 from raphaelr/mknugetsource-remove-ifd
mkNugetSource: Remove meta.licenses attribute
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/dotnet/make-nuget-source/default.nix44
1 files changed, 17 insertions, 27 deletions
diff --git a/pkgs/build-support/dotnet/make-nuget-source/default.nix b/pkgs/build-support/dotnet/make-nuget-source/default.nix
index 48de65e8a881..4cf9c1a7412a 100644
--- a/pkgs/build-support/dotnet/make-nuget-source/default.nix
+++ b/pkgs/build-support/dotnet/make-nuget-source/default.nix
@@ -3,36 +3,26 @@
 { name
 , description ? ""
 , deps ? []
-}:
+, ...
+}@args:
 
-let
-  nuget-source = stdenvNoCC.mkDerivation {
-    inherit name;
+stdenvNoCC.mkDerivation (lib.recursiveUpdate {
+  inherit name;
 
-    nativeBuildInputs = [ python3 ];
+  nativeBuildInputs = [ python3 ];
 
-    buildCommand = ''
-      mkdir -p $out/{lib,share}
+  buildCommand = ''
+    mkdir -p $out/{lib,share}
 
-      # use -L to follow symbolic links. When `projectReferences` is used in
-      # buildDotnetModule, one of the deps will be a symlink farm.
-      find -L ${lib.concatStringsSep " " deps} -type f -name '*.nupkg' -exec \
-        ln -s '{}' -t $out/lib ';'
+    # use -L to follow symbolic links. When `projectReferences` is used in
+    # buildDotnetModule, one of the deps will be a symlink farm.
+    find -L ${lib.concatStringsSep " " deps} -type f -name '*.nupkg' -exec \
+      ln -s '{}' -t $out/lib ';'
 
-      # Generates a list of all licenses' spdx ids, if available.
-      # Note that this currently ignores any license provided in plain text (e.g. "LICENSE.txt")
-      python ${./extract-licenses-from-nupkgs.py} $out/lib > $out/share/licenses
-    '';
+    # Generates a list of all licenses' spdx ids, if available.
+    # Note that this currently ignores any license provided in plain text (e.g. "LICENSE.txt")
+    python ${./extract-licenses-from-nupkgs.py} $out/lib > $out/share/licenses
+  '';
 
-    meta.description = description;
-  } // { # We need data from `$out` for `meta`, so we have to use overrides as to not hit infinite recursion.
-    meta = nuget-source.meta // {
-      licenses = let
-        # TODO: avoid IFD
-        depLicenses = lib.splitString "\n" (builtins.readFile "${nuget-source}/share/licenses");
-      in lib.flatten (lib.forEach depLicenses (spdx:
-        lib.optionals (spdx != "") (lib.getLicenseFromSpdxId spdx)
-      ));
-    };
-  };
-in nuget-source
+  meta.description = description;
+} (removeAttrs args [ "name" "description" "deps" ]))