* tv identity: hosts.*.search -> search

This commit is contained in:
tv 2015-07-23 01:02:36 +02:00
parent 504b1b90e8
commit 8e41a4be47
3 changed files with 10 additions and 16 deletions

View File

@ -4,6 +4,7 @@
imports = [ ../../3modules/tv/identity.nix ]; imports = [ ../../3modules/tv/identity.nix ];
tv.identity = { tv.identity = {
enable = true; enable = true;
search = "retiolum";
hosts = { hosts = {
cd = { cd = {
cores = 2; cores = 2;
@ -27,7 +28,6 @@
]; ];
}; };
}; };
search = "retiolum";
}; };
mkdir = { mkdir = {
cores = 1; cores = 1;
@ -41,7 +41,6 @@
]; ];
}; };
}; };
search = "retiolum";
}; };
nomic = { nomic = {
cores = 2; cores = 2;
@ -55,7 +54,6 @@
]; ];
}; };
}; };
search = "retiolum";
}; };
rmdir = { rmdir = {
cores = 1; cores = 1;
@ -70,7 +68,6 @@
]; ];
}; };
}; };
search = "retiolum";
}; };
wu = { wu = {
cores = 4; cores = 4;
@ -84,7 +81,6 @@
]; ];
}; };
}; };
search = "retiolum";
}; };
}; };
}; };

View File

@ -16,15 +16,19 @@ let
type = types.host; type = types.host;
}; };
others = mkOption { #others = mkOption {
type = types.host; # type = types.host;
default = filterAttrs (name: _host: name != cfg.self.name) cfg.hosts; # default = filterAttrs (name: _host: name != cfg.self.name) cfg.hosts;
}; #};
hosts = mkOption { hosts = mkOption {
type = with types; attrsOf host; type = with types; attrsOf host;
apply = mapAttrs (name: value: value // { inherit name; }); apply = mapAttrs (name: value: value // { inherit name; });
}; };
search = mkOption {
type = types.hostname;
};
}; };
imp = { imp = {
@ -36,7 +40,7 @@ let
let let
aliases = toString (unique (longs ++ shorts)); aliases = toString (unique (longs ++ shorts));
longs = (splitByProvider net.aliases).hosts; longs = (splitByProvider net.aliases).hosts;
shorts = map (removeSuffix ".${cfg.self.search}") longs; shorts = map (removeSuffix ".${cfg.search}") longs;
in in
map (addr: "${addr} ${aliases}") net.addrs map (addr: "${addr} ${aliases}") net.addrs
) host.nets ) host.nets

View File

@ -39,9 +39,6 @@ builtins // lib // rec {
in in
xsn >= sn && substring (xsn - sn) sn xs == s ; xsn >= sn && substring (xsn - sn) sn xs == s ;
removeSuffix =
s : xs : substring 0 (stringLength xs - stringLength s) xs;
# setMap :: (String -> a -> b) -> Set String a -> [b] # setMap :: (String -> a -> b) -> Set String a -> [b]
#setMap = f: xs: map (k : f k (getAttr k xs)) (attrNames xs); #setMap = f: xs: map (k : f k (getAttr k xs)) (attrNames xs);
@ -74,9 +71,6 @@ builtins // lib // rec {
type = attrsOf net; type = attrsOf net;
apply = x: assert hasAttr "retiolum" x; x; apply = x: assert hasAttr "retiolum" x; x;
}; };
search = mkOption {
type = hostname;
};
}; };
}; };