diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-11-18 12:12:34 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-11-19 00:07:14 -0500 |
commit | a6218c058b3e994779147dd7286606c750be7d73 (patch) | |
tree | 6d7bf3a5bbf43d953004ea725e9e4f6035d16184 /lib/customisation.nix | |
parent | f01bfd6843cada594383a5ab67c01f30b571a185 (diff) | |
download | nixlib-a6218c058b3e994779147dd7286606c750be7d73.tar nixlib-a6218c058b3e994779147dd7286606c750be7d73.tar.gz nixlib-a6218c058b3e994779147dd7286606c750be7d73.tar.bz2 nixlib-a6218c058b3e994779147dd7286606c750be7d73.tar.lz nixlib-a6218c058b3e994779147dd7286606c750be7d73.tar.xz nixlib-a6218c058b3e994779147dd7286606c750be7d73.tar.zst nixlib-a6218c058b3e994779147dd7286606c750be7d73.zip |
lib: Create `makeScopeWithSplicing`
It's ugly as hell, but I suppose it is needed to codify how to make spliced package sets.
Diffstat (limited to 'lib/customisation.nix')
-rw-r--r-- | lib/customisation.nix | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix index dc5dd7691976..37a7951896b0 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -217,4 +217,31 @@ rec { }; in self; + /* Like the above, but aims to support cross compilation. It's still ugly, but + hopefully it helps a little bit. */ + makeScopeWithSplicing = splicePackages: newScope: otherSplices: keep: f: + let + spliced = splicePackages { + pkgsBuildBuild = otherSplices.selfBuildBuild; + pkgsBuildHost = otherSplices.selfBuildHost; + pkgsBuildTarget = otherSplices.selfBuildTarget; + pkgsHostHost = otherSplices.selfHostHost; + pkgsHostTarget = self; # Not `otherSplices.selfHostTarget`; + pkgsTargetTarget = otherSplices.selfTargetTarget; + } // 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 + splicePackages + newScope + otherSplices + keep + (lib.fixedPoints.extends g f); + packages = f; + }; + in self; + } |