summaryrefslogtreecommitdiffstats
path: root/3modules/krebs
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-07-28 15:29:59 +0200
committerlassulus <lass@aidsballs.de>2015-07-28 15:29:59 +0200
commitb5d5b75d7d6dcc42f69418e6a454a64502fa6aee (patch)
tree3e3a83c1252e8600b580f858b55e05591212e05a /3modules/krebs
parent6167afb8b5f5e06a51745b71a47b6b0339aa0e99 (diff)
parent03e03a7cbda232d1e8581231aefe632072665194 (diff)
Merge branch 'tv' into master
Diffstat (limited to '3modules/krebs')
-rw-r--r--3modules/krebs/default.nix75
-rw-r--r--3modules/krebs/urlwatch.nix4
2 files changed, 40 insertions, 39 deletions
diff --git a/3modules/krebs/default.nix b/3modules/krebs/default.nix
index c71b70ab4..e14830fb8 100644
--- a/3modules/krebs/default.nix
+++ b/3modules/krebs/default.nix
@@ -20,7 +20,7 @@ let
enable = mkEnableOption "krebs";
build = mkOption {
- type = types.submodule {
+ type = types.submodule ({ config, ... }: {
options = {
target = mkOption {
type = with types; nullOr str;
@@ -129,11 +129,19 @@ let
type = types.user;
};
};
- };
+ });
# Define defaul value, so unset values of the submodule get reported.
default = {};
};
+ dns = {
+ providers = mkOption {
+ # TODO with types; tree dns.label dns.provider, so we can merge.
+ # Currently providers can only be merged if aliases occur just once.
+ type = with types; attrsOf unspecified;
+ };
+ };
+
hosts = mkOption {
type = with types; attrsOf host;
};
@@ -156,43 +164,31 @@ let
{ krebs = makefu-imp; }
{ krebs = tv-imp; }
{
- # XXX This overlaps with krebs.retiolum
- networking.extraHosts =
- let
- # TODO move domain name providers to a dedicated module
- # providers : tree label providername
- providers = {
- internet = "hosts";
- retiolum = "hosts";
- de.viljetic = "regfish";
- de.krebsco = "ovh";
- de.habsys = "hosts";
- de.pixelpocket = "hosts";
- de.karlaskop = "hosts";
- de.ubikmedia = "hosts";
- de.apanowicz = "hosts";
- };
-
- # splitByProvider : [alias] -> listset providername alias
- splitByProvider = foldl (acc: alias: listset-insert (providerOf alias) alias acc) {};
+ krebs.dns.providers = {
+ de.krebsco = "ovh";
+ internet = "hosts";
+ retiolum = "hosts";
+ de.habsys = "hosts";
+ de.pixelpocket = "hosts";
+ de.karlaskop = "hosts";
+ de.ubikmedia = "hosts";
+ de.apanowicz = "hosts";
+ };
- # providerOf : alias -> providername
- providerOf = alias:
- tree-get (splitString "." alias) providers;
- in
- concatStringsSep "\n" (flatten (
- # TODO deepMap ["hosts" "nets"] (hostname: host: netname: net:
- mapAttrsToList (hostname: host:
- mapAttrsToList (netname: net:
- let
- aliases = toString (unique (longs ++ shorts));
- longs = (splitByProvider net.aliases).hosts;
- shorts = map (removeSuffix ".${cfg.search-domain}") longs;
- in
- map (addr: "${addr} ${aliases}") net.addrs
- ) host.nets
- ) config.krebs.hosts
- ));
+ # XXX This overlaps with krebs.retiolum
+ networking.extraHosts = concatStringsSep "\n" (flatten (
+ mapAttrsToList (hostname: host:
+ mapAttrsToList (netname: net:
+ let
+ aliases = toString (unique (longs ++ shorts));
+ providers = dns.split-by-provider net.aliases cfg.dns.providers;
+ longs = providers.hosts;
+ shorts = map (removeSuffix ".${cfg.search-domain}") longs;
+ in
+ map (addr: "${addr} ${aliases}") net.addrs
+ ) host.nets
+ ) cfg.hosts
+ ));
}
];
@@ -330,6 +326,9 @@ let
};
tv-imp = {
+ dns.providers = {
+ de.viljetic = "regfish";
+ };
hosts = addNames {
cd = {
cores = 2;
diff --git a/3modules/krebs/urlwatch.nix b/3modules/krebs/urlwatch.nix
index 58de72fc6..39d9fec54 100644
--- a/3modules/krebs/urlwatch.nix
+++ b/3modules/krebs/urlwatch.nix
@@ -35,20 +35,22 @@ let
};
mailto = mkOption {
type = types.str;
+ default = config.krebs.build.user.mail;
description = ''
Content of the To: header of the generated mails. [AKA recipient :)]
'';
};
onCalendar = mkOption {
type = types.str;
+ default = "04:23";
description = ''
Run urlwatch at this interval.
The format is described in systemd.time(7), CALENDAR EVENTS.
'';
- example = "04:23";
};
urls = mkOption {
type = with types; listOf str;
+ default = [];
description = "URL to watch.";
example = [
https://nixos.org/channels/nixos-unstable/git-revision