Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 36 lines 1.1 kB view raw
1{ lib, python3, stdenvNoCC }: 2 3{ name 4, description ? "" 5, deps ? [] 6}: 7 8let 9 nuget-source = stdenvNoCC.mkDerivation rec { 10 inherit name; 11 12 meta.description = description; 13 nativeBuildInputs = [ python3 ]; 14 15 buildCommand = '' 16 mkdir -p $out/{lib,share} 17 18 ( 19 shopt -s nullglob 20 for nupkg in ${lib.concatMapStringsSep " " (dep: "\"${dep}\"/*.nupkg") deps}; do 21 cp --no-clobber "$nupkg" $out/lib 22 done 23 ) 24 25 # Generates a list of all licenses' spdx ids, if available. 26 # Note that this currently ignores any license provided in plain text (e.g. "LICENSE.txt") 27 python ${./extract-licenses-from-nupkgs.py} $out/lib > $out/share/licenses 28 ''; 29 } // { # We need data from `$out` for `meta`, so we have to use overrides as to not hit infinite recursion. 30 meta.licence = let 31 depLicenses = lib.splitString "\n" (builtins.readFile "${nuget-source}/share/licenses"); 32 in (lib.flatten (lib.forEach depLicenses (spdx: 33 lib.optionals (spdx != "") (lib.getLicenseFromSpdxId spdx) 34 ))); 35 }; 36in nuget-source