stockholm: provide krebs lib

This commit is contained in:
tv 2015-10-21 00:08:18 +02:00
parent fc45cc2926
commit 226ea391ca
14 changed files with 35 additions and 36 deletions

View File

@ -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

View File

@ -1,6 +1,6 @@
{ config, lib, ... }:
with import ../4lib { inherit lib; };
with lib;
let
target = config.krebs.build // { user.name = "root"; };

View File

@ -1,6 +1,6 @@
{ config, lib, ... }:
with import ../4lib { inherit lib; };
with lib;
let
cfg = config.krebs;

View File

@ -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;

View File

@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }:
with builtins;
with import ../4lib { inherit lib; };
with lib;
let
cfg = config.krebs.github-hosts-sync;

View File

@ -1,6 +1,6 @@
{ lib, ... }:
with import ../../4lib { inherit lib; };
with lib;
{
hosts = addNames {

View File

@ -1,6 +1,6 @@
{ lib, ... }:
with import ../../4lib { inherit lib; };
with lib;
{
hosts = addNames {

View File

@ -1,6 +1,6 @@
{ lib, ... }:
with import ../../4lib { inherit lib; };
with lib;
{
dns.providers = {

View File

@ -3,8 +3,6 @@
with builtins;
with lib;
builtins //
lib //
rec {
eq = x: y: x == y;

View File

@ -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;

View File

@ -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
''

View File

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }:
with import ../4lib { inherit lib pkgs; };
with lib;
let
out = {

View File

@ -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;

View File

@ -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;
}