summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix10
-rw-r--r--lib/types.nix24
2 files changed, 25 insertions, 9 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 7c3b0370e..149b97a72 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -95,9 +95,12 @@ let
path = dirPath + "/${relPath}";
in
nameValuePair (toPackageName name) (f path))
- (filter
- (name: name != "default.nix" && !hasPrefix "." name)
- (attrNames (readDir dirPath))));
+ (attrNames
+ (filterAttrs isNixDirEntry (readDir dirPath))));
+
+ isNixDirEntry = name: type:
+ (type == "regular" && hasSuffix ".nix" name && name != "default.nix") ||
+ (type == "directory" && !hasPrefix "." name);
# https://tools.ietf.org/html/rfc5952
normalize-ip6-addr =
@@ -191,3 +194,4 @@ let
in
lib
+// { inherit lib; }
diff --git a/lib/types.nix b/lib/types.nix
index f312b734b..67a0c6f1b 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -58,6 +58,14 @@ rec {
default = false;
};
+ consul = mkOption {
+ description = ''
+ Whether the host is a member of the global consul network
+ '';
+ type = bool;
+ default = false;
+ };
+
owner = mkOption {
type = user;
};
@@ -128,7 +136,7 @@ rec {
default = null;
};
ip4 = mkOption {
- type = nullOr (submodule {
+ type = nullOr (submodule (ip4: {
options = {
addr = mkOption {
type = addr4;
@@ -138,13 +146,15 @@ rec {
} // {
retiolum.default = "10.243.0.0/16";
wiregrill.default = "10.244.0.0/16";
- }.${config._module.args.name} or {});
+ }.${config._module.args.name} or {
+ default = "${ip4.config.addr}/32";
+ });
};
- });
+ }));
default = null;
};
ip6 = mkOption {
- type = nullOr (submodule {
+ type = nullOr (submodule (ip6: {
options = {
addr = mkOption {
type = addr6;
@@ -155,9 +165,11 @@ rec {
} // {
retiolum.default = "42:0::/32";
wiregrill.default = "42:1::/32";
- }.${config._module.args.name} or {});
+ }.${config._module.args.name} or {
+ default = "${ip6.config.addr}/128";
+ });
};
- });
+ }));
default = null;
};
ssh = mkOption {