summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-10-12 22:08:07 +0200
committertv <tv@krebsco.de>2021-10-12 22:11:08 +0200
commitbe5f4833fe1dc3ec4acb24eeb5a6670c2aaef2e0 (patch)
tree8ac195931ff99fa2214b90f63fbc6e0cb2894f97 /krebs
parent77c3aab5b860a952e9d83db56aefe23ee04ccebc (diff)
pkgs: import relative stockholm lib only once
New overlay code in inspired by <nixpkgs/pkgs/top-level/stage.nix>.
Diffstat (limited to 'krebs')
-rw-r--r--krebs/5pkgs/default.nix30
-rw-r--r--krebs/5pkgs/simple/default.nix5
-rw-r--r--krebs/default.nix2
3 files changed, 21 insertions, 16 deletions
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index f302bb76b..f9ed6439c 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -1,17 +1,23 @@
-with import ../../lib;
+let
+ stockholm.lib = import ../../lib;
+in
+with stockholm.lib;
self: super:
-
-# Import files and subdirectories like they are overlays.
-foldl' mergeAttrs {}
+fix (foldl' (flip extends) (self: super) (
+ [
+ (self: super: { inherit stockholm; })
+ ]
+ ++
(map
- (name: import (./. + "/${name}") self super)
+ (name: import (./. + "/${name}"))
(filter
(name: name != "default.nix" && !hasPrefix "." name)
(attrNames (readDir ./.))))
-
-//
-
-{
- brockman = self.haskellPackages.brockman;
- reaktor2 = self.haskellPackages.reaktor2;
-}
+ ++
+ [
+ (self: super: {
+ brockman = self.haskellPackages.brockman;
+ reaktor2 = self.haskellPackages.reaktor2;
+ })
+ ]
+))
diff --git a/krebs/5pkgs/simple/default.nix b/krebs/5pkgs/simple/default.nix
index 10458001e..76ad6ff10 100644
--- a/krebs/5pkgs/simple/default.nix
+++ b/krebs/5pkgs/simple/default.nix
@@ -2,7 +2,7 @@ self: super:
let
# This callPackage will try to detect obsolete overrides.
- lib = import ../../../lib;
+ lib = super.stockholm.lib;
callPackage = path: args: let
override = self.callPackage path args;
upstream = lib.optionalAttrs (override ? "name")
@@ -13,5 +13,4 @@ let
then lib.trace "Upstream `${upstream.name}' gets overridden by `${override.name}'." override
else override;
in
- { stockholm.lib = lib; } //
- lib.mapNixDir (path: callPackage path {}) ./.
+ lib.mapNixDir (path: callPackage path {}) ./.
diff --git a/krebs/default.nix b/krebs/default.nix
index 7ec791529..577cc269e 100644
--- a/krebs/default.nix
+++ b/krebs/default.nix
@@ -6,8 +6,8 @@
nixpkgs = {
overlays = [
- (import ./5pkgs)
(import ../submodules/nix-writers/pkgs)
+ (import ./5pkgs)
];
};