Skip to content

Commit

Permalink
mkNugetSource: Remove meta.licenses attribute
Browse files Browse the repository at this point in the history
- It's useless. The correct attribute name would be `license` and not
  `licenses`. Meaning setting this never did anything useful.
- It used IFD in its implementation, meaning to know what the licenses
  of a nuget source are, you first had to build that nuget source. This
  defeats the point of having license checks in the first place.
- IFD is not allowed by the nixpkgs CI and build farm anyway.
  • Loading branch information
raphaelr committed Jan 2, 2024
1 parent 2c5a053 commit 5fb3301
Showing 1 changed file with 15 additions and 26 deletions.
41 changes: 15 additions & 26 deletions pkgs/build-support/dotnet/make-nuget-source/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,23 @@
, deps ? []
}:

let
nuget-source = stdenvNoCC.mkDerivation {
inherit name;
stdenvNoCC.mkDerivation {
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;
}

0 comments on commit 5fb3301

Please sign in to comment.