summary refs log tree commit diff
path: root/pkgs/development/compilers/dotnet/combine-packages.nix
blob: eaae0db2fc027e62b236d654b5882dcf9f93a024 (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
29
30
31
32
33
34
dotnetPackages:
{ buildEnv, makeWrapper, lib }:
# TODO: Rethink how we determine and/or get the CLI.
#       Possible options raised in #187118:
#         1. A separate argument for the CLI (as suggested by IvarWithoutBones
#         2. Use the highest version SDK for the CLI (as suggested by GGG)
#         3. Something else?
let cli = builtins.head dotnetPackages;
in
assert lib.assertMsg ((builtins.length dotnetPackages) > 0)
    ''You must include at least one package, e.g
      `with dotnetCorePackages; combinePackages [
          sdk_6_0 aspnetcore_7_0
       ];`'' ;
  buildEnv {
    name = "dotnet-core-combined";
    paths = dotnetPackages;
    pathsToLink = [ "/host" "/packs" "/sdk" "/sdk-manifests" "/shared" "/templates" ];
    ignoreCollisions = true;
    postBuild = ''
      cp -R ${cli}/{dotnet,share,nix-support} $out/

      mkdir $out/bin
      ln -s $out/dotnet $out/bin/dotnet
    '';
    passthru = {
      inherit (cli) icu;

      versions = lib.catAttrs "version" dotnetPackages;
      packages = lib.remove null (lib.catAttrs "packages" dotnetPackages);
    };

    inherit (cli) meta;
  }