summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2022-12-12 19:44:00 +0100
committermakefu <github@syntax-fehler.de>2022-12-12 19:44:00 +0100
commit6eb5e44b7e5bdc8b1b3b5ffe40c146841f7afd10 (patch)
treef706bf7c3c7a289f680ac329caa2b578e5145a56 /lib
parent96e934dc8a353cff91ef824f6a125ed49996d058 (diff)
parent3884243448869bdf09f6434b385e532c7c26ae88 (diff)
Merge remote-tracking branch 'lass/master'
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 {