summaryrefslogtreecommitdiffstats
path: root/4lib/tv
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-07-23 00:37:21 +0200
committertv <tv@shackspace.de>2015-07-23 00:37:21 +0200
commit504b1b90e809934a01357450ccdf35c4e4afc74d (patch)
tree2b6a539ad2a9f3c4d4b2cf24034cea7e239acb51 /4lib/tv
parent14ac6d3bba12f07bd8aa79221b9c64469fe03046 (diff)
* tv identity: define type harder
Diffstat (limited to '4lib/tv')
-rw-r--r--4lib/tv/default.nix64
1 files changed, 60 insertions, 4 deletions
diff --git a/4lib/tv/default.nix b/4lib/tv/default.nix
index 164a6a1aa..6985baa90 100644
--- a/4lib/tv/default.nix
+++ b/4lib/tv/default.nix
@@ -1,12 +1,10 @@
{ lib, pkgs, ... }:
with builtins;
+with lib;
-let
- inherit (lib) mapAttrs stringAsChars;
-in
+builtins // lib // rec {
-rec {
git = import ./git.nix {
lib = lib // {
inherit addNames;
@@ -59,4 +57,62 @@ rec {
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;
+ };
+ search = mkOption {
+ type = hostname;
+ };
+ };
+ };
+
+ net = submodule ({ config, ... }: {
+ options = {
+ 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;
+ };
+ };
+ });
+
+ positive = mkOptionType {
+ name = "positive integer";
+ check = x: isInt x && x > 0;
+ merge = mergeOneOption;
+ };
+
+ # TODO
+ addr = str;
+ addr4 = str;
+ addr6 = str;
+ hostname = str;
+ label = str;
+ });
+
}