query
On this page

packages

pkgs.dotnetCorePackages.packages

Docs pulled from | This Revision | 24 minutes ago


Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.

Noogle detected

Implementation

The following is the current implementation of this function.

self:
    let
      callPackage = self.callPackage;

      fetchNupkg = callPackage ../../../build-support/dotnet/fetch-nupkg { };

      buildDotnetSdk =
        let
          buildDotnet = attrs: callWithUtils (import ./binary/build-dotnet.nix attrs) { };
        in
        version:
        import version {
          inherit fetchNupkg;
          buildAspNetCore = attrs: buildDotnet (attrs // { type = "aspnetcore"; });
          buildNetRuntime = attrs: buildDotnet (attrs // { type = "runtime"; });
          buildNetSdk = attrs: buildDotnet (attrs // { type = "sdk"; });
        };

      runtimeIdentifierMap = {
        "x86_64-linux" = "linux-x64";
        "aarch64-linux" = "linux-arm64";
        "x86_64-darwin" = "osx-x64";
        "aarch64-darwin" = "osx-arm64";
        "x86_64-windows" = "win-x64";
        "i686-windows" = "win-x86";
      };

      # used to break cycle in attribute names
      callWithUtils = newScope (utils // { callPackage = callWithUtils; });

      utils = {
        inherit
          callPackage
          fetchNupkg
          buildDotnetSdk
          ;

        generate-dotnet-sdk = writeScriptBin "generate-dotnet-sdk" (
          # Don't include current nixpkgs in the exposed version. We want to make the script runnable without nixpkgs repo.
          builtins.replaceStrings [ " -I nixpkgs=./." ] [ "" ] (builtins.readFile ./binary/update.sh)
        );

        # Convert a "stdenv.hostPlatform.system" to a dotnet RID
        systemToDotnetRid =
          system: runtimeIdentifierMap.${system} or (throw "unsupported platform ${system}");

        combinePackages = attrs: callPackage (import ./combine-packages.nix attrs) { };

        patchNupkgs = buildPackages.callPackage ./patch-nupkgs.nix { };
        nugetPackageHook = callPackage ./nuget-package-hook.nix { };
        autoPatchcilHook = callPackage ../../../build-support/dotnet/auto-patchcil-hook { };

        buildDotnetModule = callPackage ../../../build-support/dotnet/build-dotnet-module { };
        buildDotnetGlobalTool = callPackage ../../../build-support/dotnet/build-dotnet-global-tool { };

        mkNugetSource = callPackage ../../../build-support/dotnet/make-nuget-source { };
        mkNugetDeps = callPackage ../../../build-support/dotnet/make-nuget-deps { };
        addNuGetDeps = callPackage ../../../build-support/dotnet/add-nuget-deps { };
      };

    in
    utils
    // (
      let
        dotnet_6 = callWithUtils ./dotnet.nix {
          channel = "6.0";
        };

        dotnet_7 = callWithUtils ./dotnet.nix {
          channel = "7.0";
        };

        dotnet_8 = callWithUtils ./dotnet.nix {
          channel = "8.0";
        };

        dotnet_9 = callWithUtils ./dotnet.nix {
          channel = "9.0";
        };

        dotnet_10 = callWithUtils ./dotnet.nix {
          channel = "10.0";
        };

        dotnet_11 = callWithUtils ./dotnet.nix {
          channel = "11.0";
        };
      in
      lib.optionalAttrs config.allowAliases {
        # EOL
        sdk_2_1 = throw "Dotnet SDK 2.1 is EOL, please use 8.0 (LTS) or 9.0 (Current)";
        sdk_2_2 = throw "Dotnet SDK 2.2 is EOL, please use 8.0 (LTS) or 9.0 (Current)";
        sdk_3_0 = throw "Dotnet SDK 3.0 is EOL, please use 8.0 (LTS) or 9.0 (Current)";
        sdk_3_1 = throw "Dotnet SDK 3.1 is EOL, please use 8.0 (LTS) or 9.0 (Current)";
        sdk_5_0 = throw "Dotnet SDK 5.0 is EOL, please use 8.0 (LTS) or 9.0 (Current)";
      }
      // lib.mergeAttrsList [
        dotnet_6
        dotnet_7
        dotnet_8
        dotnet_9
        dotnet_10
        dotnet_11
      ]
    )