summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-07-24 13:28:35 +0200
committermakefu <github@syntax-fehler.de>2015-07-24 13:28:35 +0200
commit03855bbd707cf7ca3e891f9193d55cb031c9ba4b (patch)
tree39ada4548a0aecb8ef85344f2d86bafd7b9bede1
parent8c92c4d7291ecbb66f2254e01e2c1f42722e11bb (diff)
parent50162983e041012abbddbb562bb655498f47c354 (diff)
Merge branch 'master' of http://cgit.cd/stockholm
-rw-r--r--1systems/tv/cd.nix16
-rw-r--r--1systems/tv/nomic.nix4
-rw-r--r--1systems/tv/wu.nix8
-rw-r--r--2configs/tv/git-public.nix4
-rw-r--r--3modules/krebs/git.nix (renamed from 3modules/tv/git.nix)11
-rw-r--r--3modules/krebs/github-hosts-sync.nix (renamed from 3modules/tv/github-hosts-sync.nix)8
-rw-r--r--3modules/krebs/nginx.nix (renamed from 3modules/tv/nginx.nix)7
-rw-r--r--3modules/krebs/urlwatch.nix (renamed from 3modules/tv/urlwatch.nix)6
-rw-r--r--4lib/krebs/default.nix7
-rw-r--r--4lib/krebs/types.nix81
-rw-r--r--4lib/tv/default.nix87
-rw-r--r--Zpkgs/krebs/default.nix11
-rw-r--r--Zpkgs/krebs/github-hosts-sync.nix (renamed from Zpkgs/tv/github-hosts-sync.nix)0
-rw-r--r--Zpkgs/krebs/github-known_hosts.nix (renamed from Zpkgs/tv/github-known_hosts.nix)0
-rw-r--r--Zpkgs/tv/default.nix2
15 files changed, 138 insertions, 114 deletions
diff --git a/1systems/tv/cd.nix b/1systems/tv/cd.nix
index d3cae6f..463d643 100644
--- a/1systems/tv/cd.nix
+++ b/1systems/tv/cd.nix
@@ -29,10 +29,10 @@ in
};
}
{
- imports = [ ../../3modules/tv/github-hosts-sync.nix ];
- tv.github-hosts-sync.enable = true;
+ imports = [ ../../3modules/krebs/github-hosts-sync.nix ];
+ krebs.github-hosts-sync.enable = true;
tv.iptables.input-internet-accept-new-tcp =
- singleton config.tv.github-hosts-sync.port;
+ singleton config.krebs.github-hosts-sync.port;
}
{
imports = [ ../../2configs/tv/identity.nix ];
@@ -57,19 +57,19 @@ in
{
imports = [
../../3modules/tv/iptables.nix
- ../../3modules/tv/nginx.nix
+ ../../3modules/krebs/nginx.nix
];
tv.iptables.input-internet-accept-new-tcp = singleton "http";
- tv.nginx.servers.cgit.server-names = singleton "cgit.cd.viljetic.de";
+ krebs.nginx.servers.cgit.server-names = singleton "cgit.cd.viljetic.de";
}
{
# TODO make public_html also available to cd, cd.retiolum (AKA default)
imports = [
../../3modules/tv/iptables.nix
- ../../3modules/tv/nginx.nix
+ ../../3modules/krebs/nginx.nix
];
tv.iptables.input-internet-accept-new-tcp = singleton "http";
- tv.nginx.servers.public_html = {
+ krebs.nginx.servers.public_html = {
server-names = singleton "cd.viljetic.de";
locations = singleton (nameValuePair "~ ^/~(.+?)(/.*)?\$" ''
alias /home/$1/public_html$2;
@@ -77,7 +77,7 @@ in
};
}
{
- tv.nginx.servers.viljetic = {
+ krebs.nginx.servers.viljetic = {
server-names = singleton "viljetic.de";
# TODO directly set root (instead via location)
locations = singleton (nameValuePair "/" ''
diff --git a/1systems/tv/nomic.nix b/1systems/tv/nomic.nix
index 6f984c4..8e6812e 100644
--- a/1systems/tv/nomic.nix
+++ b/1systems/tv/nomic.nix
@@ -26,8 +26,8 @@ with lib;
};
}
{
- imports = [ ../../3modules/tv/nginx.nix ];
- tv.nginx = {
+ imports = [ ../../3modules/krebs/nginx.nix ];
+ krebs.nginx = {
enable = true;
servers.default.locations = [
(nameValuePair "~ ^/~(.+?)(/.*)?\$" ''
diff --git a/1systems/tv/wu.nix b/1systems/tv/wu.nix
index 76bb43e..1d7bbe5 100644
--- a/1systems/tv/wu.nix
+++ b/1systems/tv/wu.nix
@@ -134,8 +134,8 @@ in
};
}
{
- imports = [ ../../3modules/tv/nginx.nix ];
- tv.nginx = {
+ imports = [ ../../3modules/krebs/nginx.nix ];
+ krebs.nginx = {
enable = true;
servers.default.locations = [
(nameValuePair "~ ^/~(.+?)(/.*)?\$" ''
@@ -156,8 +156,8 @@ in
};
}
{
- imports = [ ../../3modules/tv/urlwatch.nix ];
- tv.urlwatch = {
+ imports = [ ../../3modules/krebs/urlwatch.nix ];
+ krebs.urlwatch = {
enable = true;
mailto = "tv@wu.retiolum"; # TODO
onCalendar = "*-*-* 05:00:00";
diff --git a/2configs/tv/git-public.nix b/2configs/tv/git-public.nix
index 7222f99..7f2b513 100644
--- a/2configs/tv/git-public.nix
+++ b/2configs/tv/git-public.nix
@@ -3,8 +3,8 @@ with import ../../4lib/tv { inherit lib pkgs; };
let
out = {
- imports = [ ../../3modules/tv/git.nix ];
- tv.git = {
+ imports = [ ../../3modules/krebs/git.nix ];
+ krebs.git = {
enable = true;
root-title = "public repositories at ${config.tv.identity.self.name}";
root-desc = "keep calm and engage";
diff --git a/3modules/tv/git.nix b/3modules/krebs/git.nix
index 8c73d03..3c3e934 100644
--- a/3modules/tv/git.nix
+++ b/3modules/krebs/git.nix
@@ -9,13 +9,14 @@
with builtins;
with lib;
let
- cfg = config.tv.git;
+ cfg = config.krebs.git;
out = {
+ # TODO don't import krebs.nginx here
imports = [
- ../../3modules/tv/nginx.nix
+ ../../3modules/krebs/nginx.nix
];
- options.tv.git = api;
+ options.krebs.git = api;
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.cgit cgit-imp)
git-imp
@@ -23,7 +24,7 @@ let
};
api = {
- enable = mkEnableOption "tv.git";
+ enable = mkEnableOption "krebs.git";
cgit = mkOption {
type = types.bool;
@@ -210,7 +211,7 @@ let
chown ${toString fcgitwrap-user.uid}:${toString fcgitwrap-group.gid} /tmp/cgit
'';
- tv.nginx = {
+ krebs.nginx = {
enable = true;
servers.cgit = {
server-names = [
diff --git a/3modules/tv/github-hosts-sync.nix b/3modules/krebs/github-hosts-sync.nix
index f50bf2b..c3b56ef 100644
--- a/3modules/tv/github-hosts-sync.nix
+++ b/3modules/krebs/github-hosts-sync.nix
@@ -3,15 +3,15 @@
with builtins;
with lib;
let
- cfg = config.tv.github-hosts-sync;
+ cfg = config.krebs.github-hosts-sync;
out = {
- options.tv.github-hosts-sync = api;
+ options.krebs.github-hosts-sync = api;
config = mkIf cfg.enable imp;
};
api = {
- enable = mkEnableOption "tv.github-hosts-sync";
+ enable = mkEnableOption "krebs.github-hosts-sync";
port = mkOption {
type = types.int; # TODO port type
default = 1028;
@@ -78,6 +78,6 @@ let
uid = 3220554646; # genid github-hosts-sync
};
- Zpkgs = import ../../Zpkgs/tv { inherit pkgs; };
+ Zpkgs = import ../../Zpkgs/krebs { inherit pkgs; };
in
out
diff --git a/3modules/tv/nginx.nix b/3modules/krebs/nginx.nix
index a58c495..702e8a7 100644
--- a/3modules/tv/nginx.nix
+++ b/3modules/krebs/nginx.nix
@@ -3,21 +3,22 @@
with builtins;
with lib;
let
- cfg = config.tv.nginx;
+ cfg = config.krebs.nginx;
out = {
- options.tv.nginx = api;
+ options.krebs.nginx = api;
config = mkIf cfg.enable imp;
};
api = {
- enable = mkEnableOption "tv.nginx";
+ enable = mkEnableOption "krebs.nginx";
servers = mkOption {
type = with types; attrsOf optionSet;
options = singleton {
server-names = mkOption {
type = with types; listOf str;
+ # TODO use identity
default = [
"${config.networking.hostName}"
"${config.networking.hostName}.retiolum"
diff --git a/3modules/tv/urlwatch.nix b/3modules/krebs/urlwatch.nix
index a659fc7..58de72f 100644
--- a/3modules/tv/urlwatch.nix
+++ b/3modules/krebs/urlwatch.nix
@@ -8,16 +8,16 @@
with builtins;
with lib;
let
- cfg = config.tv.urlwatch;
+ cfg = config.krebs.urlwatch;
# TODO assert sendmail's existence
out = {
- options.tv.urlwatch = api;
+ options.krebs.urlwatch = api;
config = mkIf cfg.enable imp;
};
api = {
- enable = mkEnableOption "tv.urlwatch";
+ enable = mkEnableOption "krebs.urlwatch";
dataDir = mkOption {
type = types.str;
diff --git a/4lib/krebs/default.nix b/4lib/krebs/default.nix
new file mode 100644
index 0000000..38c2a97
--- /dev/null
+++ b/4lib/krebs/default.nix
@@ -0,0 +1,7 @@
+{ lib, ... }:
+
+builtins // lib // {
+
+ types = import ./types.nix { inherit lib; };
+
+}
diff --git a/4lib/krebs/types.nix b/4lib/krebs/types.nix
new file mode 100644
index 0000000..38ed8a9
--- /dev/null
+++ b/4lib/krebs/types.nix
@@ -0,0 +1,81 @@
+{ lib, ... }:
+
+with lib;
+with types;
+
+types // rec {
+
+ host = submodule {
+ options = {
+ name = mkOption {
+ type = label;
+ };
+ dc = mkOption {
+ type = label;
+ };
+ cores = mkOption {
+ type = positive;
+ };
+ nets = mkOption {
+ type = attrsOf net;
+ apply = x: assert hasAttr "retiolum" x; x;
+ };
+ };
+ };
+
+ net = submodule ({ config, ... }: {
+ options = {
+ via = mkOption {
+ type = nullOr net;
+ default = null;
+ };
+ addrs = mkOption {
+ type = listOf addr;
+ apply = _: config.addrs4 ++ config.addrs6;
+ };
+ addrs4 = mkOption {
+ type = listOf addr4;
+ default = [];
+ };
+ addrs6 = mkOption {
+ type = listOf addr6;
+ default = [];
+ };
+ aliases = mkOption {
+ # TODO nonEmptyListOf hostname
+ type = listOf hostname;
+ };
+ tinc = mkOption {
+ type = let net-config = config; in submodule ({ config, ... }: {
+ options = {
+ config = mkOption {
+ type = str;
+ apply = _: ''
+ ${optionalString (net-config.via != null)
+ (concatMapStringsSep "\n" (a: "Address = ${a}") net-config.via.addrs)}
+ ${concatMapStringsSep "\n" (a: "Subnet = ${a}") net-config.addrs}
+ ${config.pubkey}
+ '';
+ };
+ pubkey = mkOption {
+ type = str;
+ };
+ };
+ });
+ };
+ };
+ });
+
+ positive = mkOptionType {
+ name = "positive integer";
+ check = x: isInt x && x > 0;
+ merge = mergeOneOption;
+ };
+
+ # TODO
+ addr = str;
+ addr4 = str;
+ addr6 = str;
+ hostname = str;
+ label = str;
+}
diff --git a/4lib/tv/default.nix b/4lib/tv/default.nix
index 092a962..267a858 100644
--- a/4lib/tv/default.nix
+++ b/4lib/tv/default.nix
@@ -1,9 +1,12 @@
{ lib, pkgs, ... }:
-with builtins;
-with lib;
+let
+ krebs = import ../../4lib/krebs { inherit lib; };
+in
-builtins // lib // rec {
+with krebs;
+
+krebs // rec {
git = import ./git.nix {
lib = lib // {
@@ -53,82 +56,4 @@ builtins // lib // rec {
if isSafeChar c then c
else if c == "\n" then "'\n'"
else "\\${c}");
-
- types = lib.types // (with lib.types; rec {
-
- host = submodule {
- options = {
- name = mkOption {
- type = label;
- };
- dc = mkOption {
- type = label;
- };
- cores = mkOption {
- type = positive;
- };
- nets = mkOption {
- type = attrsOf net;
- apply = x: assert hasAttr "retiolum" x; x;
- };
- };
- };
-
- net = submodule ({ config, ... }: {
- options = {
- via = mkOption {
- type = nullOr net;
- default = null;
- };
- addrs = mkOption {
- type = listOf addr;
- apply = _: config.addrs4 ++ config.addrs6;
- };
- addrs4 = mkOption {
- type = listOf addr4;
- default = [];
- };
- addrs6 = mkOption {
- type = listOf addr6;
- default = [];
- };
- aliases = mkOption {
- # TODO nonEmptyListOf hostname
- type = listOf hostname;
- };
- tinc = mkOption {
- type = let net-config = config; in submodule ({ config, ... }: {
- options = {
- config = mkOption {
- type = str;
- apply = _: ''
- ${optionalString (net-config.via != null)
- (concatMapStringsSep "\n" (a: "Address = ${a}") net-config.via.addrs)}
- ${concatMapStringsSep "\n" (a: "Subnet = ${a}") net-config.addrs}
- ${config.pubkey}
- '';
- };
- pubkey = mkOption {
- type = str;
- };
- };
- });
- };
- };
- });
-
- positive = mkOptionType {
- name = "positive integer";
- check = x: isInt x && x > 0;
- merge = mergeOneOption;
- };
-
- # TODO
- addr = str;
- addr4 = str;
- addr6 = str;
- hostname = str;
- label = str;
- });
-
}
diff --git a/Zpkgs/krebs/default.nix b/Zpkgs/krebs/default.nix
new file mode 100644
index 0000000..be8f720
--- /dev/null
+++ b/Zpkgs/krebs/default.nix
@@ -0,0 +1,11 @@
+{ pkgs, ... }:
+
+let
+ inherit (pkgs) callPackage;
+in
+
+pkgs //
+{
+ github-hosts-sync = callPackage ./github-hosts-sync.nix {};
+ github-known_hosts = callPackage ./github-known_hosts.nix {};
+}
diff --git a/Zpkgs/tv/github-hosts-sync.nix b/Zpkgs/krebs/github-hosts-sync.nix
index d69b2b1..d69b2b1 100644
--- a/Zpkgs/tv/github-hosts-sync.nix
+++ b/Zpkgs/krebs/github-hosts-sync.nix
diff --git a/Zpkgs/tv/github-known_hosts.nix b/Zpkgs/krebs/github-known_hosts.nix
index 302fdd8..302fdd8 100644
--- a/Zpkgs/tv/github-known_hosts.nix
+++ b/Zpkgs/krebs/github-known_hosts.nix
diff --git a/Zpkgs/tv/default.nix b/Zpkgs/tv/default.nix
index fa9fff8..e3e12bd 100644
--- a/Zpkgs/tv/default.nix
+++ b/Zpkgs/tv/default.nix
@@ -9,8 +9,6 @@ pkgs //
charybdis = callPackage ./charybdis {};
dic = callPackage ./dic.nix {};
genid = callPackage ./genid.nix {};
- github-hosts-sync = callPackage ./github-hosts-sync.nix {};
- github-known_hosts = callPackage ./github-known_hosts.nix {};
lentil = callPackage ./lentil {};
much = callPackage ./much.nix {};
viljetic-pages = callPackage ./viljetic-pages {};