From b0094ce0e498b9661de62e472121aaaf5b83c40d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2015 02:58:21 +0100 Subject: stockholm: check if default.nix exists before importing --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index ac748c286..c001b8c13 100644 --- a/default.nix +++ b/default.nix @@ -32,7 +32,7 @@ let stockholm = { upath = lib.nspath current-user-name; base-module = { config, ... }: { - imports = builtins.filter builtins.pathExists (lib.concatLists [ + imports = builtins.filter lib.dir.has-default-nix (lib.concatLists [ (map (f: f "2configs") [ upath ]) (map (f: f "3modules") [ kpath upath ]) ]); -- cgit v1.2.3 From 1f39b86dad2f8ddeb8008f6dda02a6dea1c369a6 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2015 18:52:11 +0100 Subject: stockholm: import user lib if it exists --- default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index c001b8c13..d62e43a1f 100644 --- a/default.nix +++ b/default.nix @@ -17,8 +17,10 @@ let stockholm = { let lib = import ; klib = import ./krebs/4lib { inherit lib; }; - #ulib = import (./. + "/${current-user-name}/4lib") { lib = lib // klib; }; - ulib = {}; # TODO + 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 -- cgit v1.2.3 From 9cfc10a1ec6674dde1905a5fedc4bcb56185271b Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2015 19:10:45 +0100 Subject: stockholm: check harder if user lib exists --- default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index d62e43a1f..78923110a 100644 --- a/default.nix +++ b/default.nix @@ -19,8 +19,9 @@ let stockholm = { klib = import ./krebs/4lib { inherit lib; }; ulib = let path = ./. + "/${current-user-name}/4lib"; - in lib.optionalAttrs (klib.dir.has-default-nix path) - (import path { lib = lib // klib; }); + in lib.optionalAttrs + (builtins.pathExists path && klib.dir.has-default-nix path) + (import path { lib = lib // klib; }); in builtins // lib // klib // ulib // rec { # TODO move this stuff -- cgit v1.2.3 From 6f325f7de9c9fd6bb917090c2763b67e37eb26f3 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2015 19:12:35 +0100 Subject: Revert "stockholm: check harder if user lib exists" This reverts commit 9cfc10a1ec6674dde1905a5fedc4bcb56185271b. --- default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 78923110a..d62e43a1f 100644 --- a/default.nix +++ b/default.nix @@ -19,9 +19,8 @@ let stockholm = { klib = import ./krebs/4lib { inherit lib; }; ulib = let path = ./. + "/${current-user-name}/4lib"; - in lib.optionalAttrs - (builtins.pathExists path && klib.dir.has-default-nix path) - (import path { lib = lib // klib; }); + in lib.optionalAttrs (klib.dir.has-default-nix path) + (import path { lib = lib // klib; }); in builtins // lib // klib // ulib // rec { # TODO move this stuff -- cgit v1.2.3 From 6e6f5e7379ff02de1be2a7d3546338e70180f789 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 9 Nov 2015 19:49:18 +0100 Subject: stockholm: overhaul lib generation --- default.nix | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index d62e43a1f..1637aa464 100644 --- a/default.nix +++ b/default.nix @@ -13,42 +13,36 @@ let stockholm = { krebs = import ./krebs (args // { inherit lib stockholm; }); - lib = - let - lib = import ; - klib = import ./krebs/4lib { inherit lib; }; - 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 + lib = let + nlib = import ; + klib = import (slib.kpath "4lib") { lib = nlib; }; + slib = rec { stockholm-path = ./.; 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; - kpath = lib.nspath "krebs"; - upath = lib.nspath current-user-name; - base-module = { config, ... }: { imports = builtins.filter lib.dir.has-default-nix (lib.concatLists [ - (map (f: f "2configs") [ upath ]) - (map (f: f "3modules") [ kpath upath ]) + (map (f: f "2configs") [ lib.upath ]) + (map (f: f "3modules") [ lib.kpath lib.upath ]) ]); krebs.current.enable = true; krebs.current.host = config.krebs.hosts.${current-host-name}; krebs.current.user = config.krebs.users.${current-user-name}; - nixpkgs.config.packageOverrides = pkgs: - let - kpkgs = import (kpath "5pkgs") { inherit lib pkgs; }; - upkgs = import (upath "5pkgs") { inherit lib; pkgs = pkgs // kpkgs; }; - in - kpkgs // upkgs; + nixpkgs.config.packageOverrides = pkgs: let + kpkgs = import (lib.kpath "5pkgs") { inherit lib pkgs; }; + upkgs = import (lib.upath "5pkgs") { inherit lib; pkgs = pkgs // kpkgs; }; + in kpkgs // upkgs; }; eval = config: import { -- cgit v1.2.3