Skip to content

Commit

Permalink
lib: introduce config
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil committed Sep 7, 2018
1 parent 965e52d commit 8fccd88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ let
callLibs = file: import file { lib = self; };
in with self; {

# Configuration of lib, can be set by doing
# lib.extend (self: super: { config = ...; })
# One can get this value through lib.config
# The Nixpkgs configuration will be passed like this
config = {};

# often used, or depending on very little
trivial = callLibs ./trivial.nix;
fixedPoints = callLibs ./fixed-points.nix;
Expand Down
5 changes: 4 additions & 1 deletion pkgs/top-level/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ let # Rename the function arguments
crossSystem0 = crossSystem;

in let
lib = import ../../lib;

# Allow both:
# { /* the config */ } and
Expand All @@ -53,6 +52,10 @@ in let
then configExpr { inherit pkgs; }
else configExpr;

lib = (import ../../lib).extend (self: super: {
inherit config;
});

# From a minimum of `system` or `config` (actually a target triple, *not*
# nixpkgs configuration), infer the other one and platform as needed.
localSystem = lib.systems.elaborate (
Expand Down

0 comments on commit 8fccd88

Please sign in to comment.