query
On this page

makeScopeWithSplicing'

pkgs.makeScopeWithSplicing'

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

{
      otherSplices,
      # Attrs from `self` which won't be spliced.
      # Avoid using keep, it's only used for a python hook workaround, added in PR #104201.
      # ex: `keep = (self: { inherit (self) aAttr; })`
      keep ? (_self: { }),
      # Additional attrs to add to the sets `callPackage`.
      # When the package is from a subset (but not a subset within a package IS #211340)
      # within `spliced0` it will be spliced.
      # When using an package outside the set but it's available from `pkgs`, use the package from `pkgs.__splicedPackages`.
      # If the package is not available within the set or in `pkgs`, such as a package in a let binding, it will not be spliced
      # ex:
      # ```
      # nix-repl> darwin.apple_sdk.frameworks.CoreFoundation
      #   «derivation ...CoreFoundation-11.0.0.drv»
      # nix-repl> darwin.CoreFoundation
      #   error: attribute 'CoreFoundation' missing
      # nix-repl> darwin.callPackage ({ CoreFoundation }: CoreFoundation) { }
      #   «derivation ...CoreFoundation-11.0.0.drv»
      # ```
      extra ? (_spliced0: { }),
      f,
    }:
    let
      spliced0 = splicePackages {
        pkgsBuildBuild = otherSplices.selfBuildBuild;
        pkgsBuildHost = otherSplices.selfBuildHost;
        pkgsBuildTarget = otherSplices.selfBuildTarget;
        pkgsHostHost = otherSplices.selfHostHost;
        pkgsHostTarget = self; # Not `otherSplices.selfHostTarget`;
        pkgsTargetTarget = otherSplices.selfTargetTarget;
      };
      spliced = extra spliced0 // spliced0 // keep self;
      self = f self // {
        newScope = scope: newScope (spliced // scope);
        callPackage = newScope spliced; # == self.newScope {};
        # N.B. the other stages of the package set spliced in are *not*
        # overridden.
        overrideScope =
          g:
          (makeScopeWithSplicing' { inherit splicePackages newScope; } {
            inherit otherSplices keep extra;
            f = extends g f;
          });
        packages = f;
      };
    in
    self