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; inherit (eval {}) pkgs;
}; };
krebs = import ./krebs (current // { inherit stockholm; }); krebs = import ./krebs (current // { inherit lib stockholm; });
inherit (krebs) lib;
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. # Path resolvers for common and individual files.
# Example: `upath "3modules"` produces the current user's 3modules directory # Example: `upath "3modules"` produces the current user's 3modules directory
@ -65,8 +77,8 @@ let stockholm = {
let let
# Notice the ordering. Krebs packages can only depend on Nixpkgs, # Notice the ordering. Krebs packages can only depend on Nixpkgs,
# whereas user packages additionally can depend on krebs packages. # whereas user packages additionally can depend on krebs packages.
kpkgs = import (kpath "5pkgs") { inherit pkgs; }; kpkgs = import (kpath "5pkgs") { inherit lib pkgs; };
upkgs = import (upath "5pkgs") { pkgs = pkgs // kpkgs; }; upkgs = import (upath "5pkgs") { inherit lib; pkgs = pkgs // kpkgs; };
in in
kpkgs // upkgs; kpkgs // upkgs;
}; };
@ -76,8 +88,10 @@ let stockholm = {
# packages and modules on top of NixOS. Some of this stuff might become # 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 # useful to a broader audience, at which point it should probably be merged
# and pull-requested for inclusion into NixOS/nixpkgs. # 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> { eval = config: import <nixpkgs/nixos/lib/eval-config.nix> {
specialArgs = {
inherit lib;
};
modules = [ modules = [
base-module base-module
config config

View File

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

View File

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

View File

@ -6,7 +6,7 @@
# TODO when authorized_keys changes, then restart ssh # TODO when authorized_keys changes, then restart ssh
# (or kill already connected users somehow) # (or kill already connected users somehow)
with import ../4lib { inherit lib; }; with lib;
let let
cfg = config.krebs.git; cfg = config.krebs.git;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
{ pkgs, ... }: { lib, pkgs, ... }:
with import ../4lib { inherit (pkgs) lib; };
with lib;
let let
subdirs = mapAttrs (_: flip pkgs.callPackage {}) (subdirsOf ./.); subdirs = mapAttrs (_: flip pkgs.callPackage {}) (subdirsOf ./.);
pkgs' = pkgs // subdirs; pkgs' = pkgs // subdirs;

View File

@ -1,6 +1,7 @@
{ current-date { current-date
, current-host-name , current-host-name
, current-user-name , current-user-name
, lib
, stockholm , stockholm
}: }:
@ -8,7 +9,6 @@ let out = {
inherit deploy; inherit deploy;
inherit infest; inherit infest;
inherit init; inherit init;
inherit lib;
inherit nixos-install; 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: doc = s:
let b = "EOF${builtins.hashString "sha256" s}"; in let b = "EOF${builtins.hashString "sha256" s}"; in
'' ''

View File

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

View File

@ -5,7 +5,7 @@
# TODO consul-bootstrap HOST that actually does is # TODO consul-bootstrap HOST that actually does is
# TODO tools to inspect state of a cluster in outage state # TODO tools to inspect state of a cluster in outage state
with import ../4lib { inherit lib pkgs; }; with lib;
let let
cfg = config.tv.consul; cfg = config.tv.consul;

View File

@ -1,20 +1,14 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
let lib // rec {
krebs = import ../../krebs/4lib { inherit lib; };
in
with krebs;
krebs // rec {
git = import ./git.nix { git = import ./git.nix {
lib = krebs; inherit lib pkgs;
inherit pkgs;
}; };
# "7.4.335" -> "74" # "7.4.335" -> "74"
majmin = with lib; x : concatStrings (take 2 (splitString "." x)); 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;
} }