stockholm: overhaul lib generation

This commit is contained in:
tv 2015-11-09 19:49:18 +01:00
parent 6f325f7de9
commit 6e6f5e7379
1 changed files with 16 additions and 22 deletions

View File

@ -13,42 +13,36 @@ let stockholm = {
krebs = import ./krebs (args // { inherit lib stockholm; }); krebs = import ./krebs (args // { inherit lib stockholm; });
lib = lib = let
let nlib = import <nixpkgs/lib>;
lib = import <nixpkgs/lib>; klib = import (slib.kpath "4lib") { lib = nlib; };
klib = import ./krebs/4lib { inherit lib; }; slib = rec {
ulib = let
path = ./. + "/${current-user-name}/4lib";
in lib.optionalAttrs (klib.dir.has-default-nix path)
(import path { lib = lib // klib; });
in
builtins // lib // klib // ulib // rec {
# TODO move this stuff
stockholm-path = ./.; stockholm-path = ./.;
nspath = ns: p: stockholm-path + "/${ns}/${p}"; nspath = ns: p: stockholm-path + "/${ns}/${p}";
kpath = nspath "krebs";
upath = nspath current-user-name;
}; };
ulib = let p = slib.upath "4lib"; in
nlib.optionalAttrs (klib.dir.has-default-nix p)
(import p { lib = nlib // klib; });
in nlib // klib // slib // ulib // builtins;
inherit (eval {}) pkgs; inherit (eval {}) pkgs;
kpath = lib.nspath "krebs";
upath = lib.nspath current-user-name;
base-module = { config, ... }: { base-module = { config, ... }: {
imports = builtins.filter lib.dir.has-default-nix (lib.concatLists [ imports = builtins.filter lib.dir.has-default-nix (lib.concatLists [
(map (f: f "2configs") [ upath ]) (map (f: f "2configs") [ lib.upath ])
(map (f: f "3modules") [ kpath upath ]) (map (f: f "3modules") [ lib.kpath lib.upath ])
]); ]);
krebs.current.enable = true; krebs.current.enable = true;
krebs.current.host = config.krebs.hosts.${current-host-name}; krebs.current.host = config.krebs.hosts.${current-host-name};
krebs.current.user = config.krebs.users.${current-user-name}; krebs.current.user = config.krebs.users.${current-user-name};
nixpkgs.config.packageOverrides = pkgs: nixpkgs.config.packageOverrides = pkgs: let
let kpkgs = import (lib.kpath "5pkgs") { inherit lib pkgs; };
kpkgs = import (kpath "5pkgs") { inherit lib pkgs; }; upkgs = import (lib.upath "5pkgs") { inherit lib; pkgs = pkgs // kpkgs; };
upkgs = import (upath "5pkgs") { inherit lib; pkgs = pkgs // kpkgs; }; in kpkgs // upkgs;
in
kpkgs // upkgs;
}; };
eval = config: import <nixpkgs/nixos/lib/eval-config.nix> { eval = config: import <nixpkgs/nixos/lib/eval-config.nix> {