query
On this page

mkSystemFromSkeleton

lib.systems.parse.mkSystemFromSkeleton

Docs pulled from | This Revision | 16 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.

{
      cpu,
      # Optional, but fallback too complex for here.
      # Inferred below instead.
      vendor ?
        assert false;
        null,
      kernel,
      # Also inferred below
      abi ?
        assert false;
        null,
    }@args:
    let
      parsed = {
        cpu = getCpu args.cpu;
        vendor =
          if args ? vendor then
            getVendor args.vendor
          else if isDarwin parsed then
            vendors.apple
          else if (isWindows parsed || isCygwin parsed) then
            vendors.pc
          else
            vendors.unknown;
        kernel =
          if hasDarwinPrefix args.kernel then
            kernels.darwin
          else if hasBsdPrefix args.kernel then
            kernels.netbsd
          else
            getKernel (removeAbiSuffix args.kernel);
        abi =
          if args ? abi then
            getAbi args.abi
          else if isLinux parsed || isWindows parsed then
            if isAarch32 parsed then
              if versionAtLeast (parsed.cpu.version or "0") "6" then abis.gnueabihf else abis.gnueabi
            # Default ppc64 BE to ELFv1
            else if isPower64 parsed && isBigEndian parsed then
              abis.gnuabielfv1
            else
              abis.gnu
          else
            abis.unknown;
      };

    in
    parsed