about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/dotnet/make-nuget-source/default.nix
blob: 4cf9c1a7412af9f7ebd9d53c6ac19874f52ac7e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ lib, python3, stdenvNoCC }:

{ name
, description ? ""
, deps ? []
, ...
}@args:

stdenvNoCC.mkDerivation (lib.recursiveUpdate {
  inherit name;

  nativeBuildInputs = [ python3 ];

  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 ';'

    # 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;
} (removeAttrs args [ "name" "description" "deps" ]))