diff options
author | Artturin <Artturin@artturin.com> | 2022-12-24 17:33:06 +0200 |
---|---|---|
committer | Artturin <Artturin@artturin.com> | 2022-12-25 14:05:02 +0200 |
commit | 665e15ee407ea3d08c80344fa1da2bad34e78650 (patch) | |
tree | cc3d62b0a61b72270bf519738c9688284c39fd47 /pkgs/top-level/splice.nix | |
parent | 0a3d3512401648f6b760111552a7f59dae412023 (diff) | |
download | nixpkgs-665e15ee407ea3d08c80344fa1da2bad34e78650.tar nixpkgs-665e15ee407ea3d08c80344fa1da2bad34e78650.tar.gz nixpkgs-665e15ee407ea3d08c80344fa1da2bad34e78650.tar.bz2 nixpkgs-665e15ee407ea3d08c80344fa1da2bad34e78650.tar.lz nixpkgs-665e15ee407ea3d08c80344fa1da2bad34e78650.tar.xz nixpkgs-665e15ee407ea3d08c80344fa1da2bad34e78650.tar.zst nixpkgs-665e15ee407ea3d08c80344fa1da2bad34e78650.zip |
splice.nix: add convenience functions
Diffstat (limited to 'pkgs/top-level/splice.nix')
-rw-r--r-- | pkgs/top-level/splice.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkgs/top-level/splice.nix b/pkgs/top-level/splice.nix index 4c85c7567c3..ce536aa1fd2 100644 --- a/pkgs/top-level/splice.nix +++ b/pkgs/top-level/splice.nix @@ -146,6 +146,24 @@ in newScope = extra: lib.callPackageWith (splicedPackagesWithXorg // extra); + # prefill 2 fields of the function for convenience + makeScopeWithSplicing = lib.makeScopeWithSplicing splicePackages pkgs.newScope; + + # generate 'otherSplices' for 'makeScopeWithSplicing' + generateSplicesForMkScope = attr: + let + split = X: lib.splitString "." "${X}.${attr}"; + in + { + # nulls should never be reached + selfBuildBuild = lib.attrByPath (split "pkgsBuildBuild") null pkgs; + selfBuildHost = lib.attrByPath (split "pkgsBuildHost") null pkgs; + selfBuildTarget = lib.attrByPath (split "pkgsBuildTarget") null pkgs; + selfHostHost = lib.attrByPath (split "pkgsHostHost") null pkgs; + selfHostTarget = lib.attrByPath (split "pkgsHostTarget") null pkgs; + selfTargetTarget = lib.attrByPath (split "pkgsTargetTarget") { } pkgs; + }; + # Haskell package sets need this because they reimplement their own # `newScope`. __splicedPackages = splicedPackages // { recurseForDerivations = false; }; |