summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--default.nix24
-rw-r--r--krebs/3modules/build.nix2
-rw-r--r--krebs/3modules/default.nix2
-rw-r--r--krebs/3modules/git.nix2
-rw-r--r--krebs/3modules/github-hosts-sync.nix3
-rw-r--r--krebs/3modules/lass/default.nix2
-rw-r--r--krebs/3modules/makefu/default.nix2
-rw-r--r--krebs/3modules/tv/default.nix2
-rw-r--r--krebs/4lib/default.nix2
-rw-r--r--krebs/5pkgs/default.nix5
-rw-r--r--krebs/default.nix7
-rw-r--r--tv/2configs/test.nix2
-rw-r--r--tv/3modules/consul.nix2
-rw-r--r--tv/4lib/default.nix14
14 files changed, 35 insertions, 36 deletions
diff --git a/default.nix b/default.nix
index 11bae7d98..c70225174 100644
--- a/default.nix
+++ b/default.nix
@@ -47,8 +47,20 @@ let stockholm = {
inherit (eval {}) pkgs;
};
- krebs = import ./krebs (current // { inherit stockholm; });
- inherit (krebs) lib;
+ krebs = import ./krebs (current // { inherit lib stockholm; });
+
+ lib =
+ let
+ lib = import <nixpkgs/lib>;
+ klib = import ./krebs/4lib { inherit lib; };
+ #ulib = import (./. + "/${current-user-name}/4lib") { lib = lib // klib; };
+ ulib = {}; # TODO
+ in
+ builtins // lib // klib // ulib // rec {
+ # TODO move this stuff
+ stockholm-path = ./.;
+ nspath = ns: p: stockholm-path + "/${ns}/${p}";
+ };
# Path resolvers for common and individual files.
# Example: `upath "3modules"` produces the current user's 3modules directory
@@ -65,8 +77,8 @@ let stockholm = {
let
# Notice the ordering. Krebs packages can only depend on Nixpkgs,
# whereas user packages additionally can depend on krebs packages.
- kpkgs = import (kpath "5pkgs") { inherit pkgs; };
- upkgs = import (upath "5pkgs") { pkgs = pkgs // kpkgs; };
+ kpkgs = import (kpath "5pkgs") { inherit lib pkgs; };
+ upkgs = import (upath "5pkgs") { inherit lib; pkgs = pkgs // kpkgs; };
in
kpkgs // upkgs;
};
@@ -76,8 +88,10 @@ let stockholm = {
# packages and modules on top of NixOS. Some of this stuff might become
# useful to a broader audience, at which point it should probably be merged
# and pull-requested for inclusion into NixOS/nixpkgs.
- # TODO provide krebs lib, so modules don't have to import it awkwardly
eval = config: import <nixpkgs/nixos/lib/eval-config.nix> {
+ specialArgs = {
+ inherit lib;
+ };
modules = [
base-module
config
diff --git a/krebs/3modules/build.nix b/krebs/3modules/build.nix
index 57495ea69..1205e192b 100644
--- a/krebs/3modules/build.nix
+++ b/krebs/3modules/build.nix
@@ -1,6 +1,6 @@
{ config, lib, ... }:
-with import ../4lib { inherit lib; };
+with lib;
let
target = config.krebs.build // { user.name = "root"; };
diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix
index 756245c0b..c695589ca 100644
--- a/krebs/3modules/default.nix
+++ b/krebs/3modules/default.nix
@@ -1,6 +1,6 @@
{ config, lib, ... }:
-with import ../4lib { inherit lib; };
+with lib;
let
cfg = config.krebs;
diff --git a/krebs/3modules/git.nix b/krebs/3modules/git.nix
index 64b7820b2..234129497 100644
--- a/krebs/3modules/git.nix
+++ b/krebs/3modules/git.nix
@@ -6,7 +6,7 @@
# TODO when authorized_keys changes, then restart ssh
# (or kill already connected users somehow)
-with import ../4lib { inherit lib; };
+with lib;
let
cfg = config.krebs.git;
diff --git a/krebs/3modules/github-hosts-sync.nix b/krebs/3modules/github-hosts-sync.nix
index 2a1df9e03..5503ee8d6 100644
--- a/krebs/3modules/github-hosts-sync.nix
+++ b/krebs/3modules/github-hosts-sync.nix
@@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }:
-with builtins;
-with import ../4lib { inherit lib; };
+with lib;
let
cfg = config.krebs.github-hosts-sync;
diff --git a/krebs/3modules/lass/default.nix b/krebs/3modules/lass/default.nix
index 3f81acb9e..d86c00563 100644
--- a/krebs/3modules/lass/default.nix
+++ b/krebs/3modules/lass/default.nix
@@ -1,6 +1,6 @@
{ lib, ... }:
-with import ../../4lib { inherit lib; };
+with lib;
let
testHosts = lib.genAttrs [
diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix
index acc5d7dd2..42764e48c 100644
--- a/krebs/3modules/makefu/default.nix
+++ b/krebs/3modules/makefu/default.nix
@@ -1,6 +1,6 @@
{ lib, ... }:
-with import ../../4lib { inherit lib; };
+with lib;
{
hosts = addNames {
diff --git a/krebs/3modules/tv/default.nix b/krebs/3modules/tv/default.nix
index 5d5fead8f..5a1ff1416 100644
--- a/krebs/3modules/tv/default.nix
+++ b/krebs/3modules/tv/default.nix
@@ -1,6 +1,6 @@
{ lib, ... }:
-with import ../../4lib { inherit lib; };
+with lib;
{
dns.providers = {
diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix
index 0a6101314..396307c22 100644
--- a/krebs/4lib/default.nix
+++ b/krebs/4lib/default.nix
@@ -3,8 +3,6 @@
with builtins;
with lib;
-builtins //
-lib //
rec {
eq = x: y: x == y;
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index 84fb8725b..0ec4b3ded 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -1,7 +1,6 @@
-{ pkgs, ... }:
-
-with import ../4lib { inherit (pkgs) lib; };
+{ lib, pkgs, ... }:
+with lib;
let
subdirs = mapAttrs (_: flip pkgs.callPackage {}) (subdirsOf ./.);
pkgs' = pkgs // subdirs;
diff --git a/krebs/default.nix b/krebs/default.nix
index de805a89c..5518a4496 100644
--- a/krebs/default.nix
+++ b/krebs/default.nix
@@ -1,6 +1,7 @@
{ current-date
, current-host-name
, current-user-name
+, lib
, stockholm
}:
@@ -8,7 +9,6 @@ let out = {
inherit deploy;
inherit infest;
inherit init;
- inherit lib;
inherit nixos-install;
};
@@ -131,11 +131,6 @@ let out = {
''}
'';
- lib = import ./4lib { lib = import <nixpkgs/lib>; } // rec {
- stockholm-path = ../.;
- nspath = ns: p: stockholm-path + "/${ns}/${p}";
- };
-
doc = s:
let b = "EOF${builtins.hashString "sha256" s}"; in
''
diff --git a/tv/2configs/test.nix b/tv/2configs/test.nix
index 409b4e9b4..f5f068d6f 100644
--- a/tv/2configs/test.nix
+++ b/tv/2configs/test.nix
@@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }:
-with import ../4lib { inherit lib pkgs; };
+with lib;
let
out = {
diff --git a/tv/3modules/consul.nix b/tv/3modules/consul.nix
index e764ab7b2..ccdee07f5 100644
--- a/tv/3modules/consul.nix
+++ b/tv/3modules/consul.nix
@@ -5,7 +5,7 @@
# TODO consul-bootstrap HOST that actually does is
# TODO tools to inspect state of a cluster in outage state
-with import ../4lib { inherit lib pkgs; };
+with lib;
let
cfg = config.tv.consul;
diff --git a/tv/4lib/default.nix b/tv/4lib/default.nix
index 106535ba2..7e6b2ab17 100644
--- a/tv/4lib/default.nix
+++ b/tv/4lib/default.nix
@@ -1,20 +1,14 @@
{ lib, pkgs, ... }:
-let
- krebs = import ../../krebs/4lib { inherit lib; };
-in
-
-with krebs;
-
-krebs // rec {
+lib // rec {
git = import ./git.nix {
- lib = krebs;
- inherit pkgs;
+ inherit lib pkgs;
};
# "7.4.335" -> "74"
majmin = with lib; x : concatStrings (take 2 (splitString "." x));
- shell-escape = krebs.shell.escape;
+ # TODO deprecate shell-escape for lass
+ shell-escape = lib.shell.escape;
}