core/pkgs/build-support/dotnet/make-nuget-source/default.nix

44 lines
942 B
Nix
Raw Normal View History

2024-06-30 08:12:46 +00:00
{
lib,
python3,
stdenvNoCC,
}:
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
{
name,
description ? "",
deps ? [ ],
...
2024-05-02 00:46:19 +00:00
}@args:
2024-06-30 08:12:46 +00:00
stdenvNoCC.mkDerivation (
lib.recursiveUpdate
{
inherit name;
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
nativeBuildInputs = [ python3 ];
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
buildCommand = ''
mkdir -p $out/{lib,share}
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
# 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 ';'
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
# 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
'';
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
meta.description = description;
}
(
removeAttrs args [
"name"
"description"
"deps"
]
)
)