at master 2.1 kB view raw
1dotnetPackages: 2{ 3 buildEnv, 4 makeWrapper, 5 lib, 6 symlinkJoin, 7 callPackage, 8}: 9# TODO: Rethink how we determine and/or get the CLI. 10# Possible options raised in #187118: 11# 1. A separate argument for the CLI (as suggested by IvarWithoutBones 12# 2. Use the highest version SDK for the CLI (as suggested by GGG) 13# 3. Something else? 14let 15 cli = builtins.head dotnetPackages; 16 mkWrapper = callPackage ./wrapper.nix { }; 17in 18assert lib.assertMsg ((builtins.length dotnetPackages) > 0) '' 19 You must include at least one package, e.g 20 `with dotnetCorePackages; combinePackages [ 21 sdk_9_0 aspnetcore_8_0 22 ];`''; 23mkWrapper "sdk" ( 24 (buildEnv { 25 name = "dotnet-combined"; 26 paths = dotnetPackages; 27 pathsToLink = map (x: "/share/dotnet/${x}") [ 28 "host" 29 "metadata" 30 "packs" 31 "sdk" 32 "sdk-manifests" 33 "shared" 34 "templates" 35 ]; 36 ignoreCollisions = true; 37 nativeBuildInputs = [ makeWrapper ]; 38 postBuild = '' 39 mkdir -p "$out"/share/dotnet 40 cp "${cli}"/share/dotnet/dotnet $out/share/dotnet 41 cp -R "${cli}"/nix-support "$out"/ 42 mkdir "$out"/bin 43 ln -s "$out"/share/dotnet/dotnet "$out"/bin/dotnet 44 '' 45 + lib.optionalString (cli ? man) '' 46 ln -s ${cli.man} $man 47 ''; 48 passthru = { 49 pname = "dotnet"; 50 version = "combined"; 51 inherit (cli) icu; 52 53 versions = lib.catAttrs "version" dotnetPackages; 54 packages = lib.concatLists (lib.catAttrs "packages" dotnetPackages); 55 targetPackages = lib.zipAttrsWith (_: lib.concatLists) ( 56 lib.catAttrs "targetPackages" dotnetPackages 57 ); 58 }; 59 60 meta = { 61 description = "${cli.meta.description or "dotnet"} (combined)"; 62 inherit (cli.meta) 63 homepage 64 license 65 mainProgram 66 maintainers 67 platforms 68 ; 69 }; 70 }).overrideAttrs 71 { 72 propagatedSandboxProfile = toString ( 73 lib.unique (lib.concatLists (lib.catAttrs "__propagatedSandboxProfile" dotnetPackages)) 74 ); 75 } 76)