From 16d2c2e23d2b5d5f75b820285aa038a4d15342cc Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 15 Nov 2022 15:48:15 +0100 Subject: lib.host: add consul option --- lib/types.nix | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/types.nix b/lib/types.nix index f312b73..0e0e093 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; }; -- cgit v1.2.3 From 4d78208a98efa9612e77decc6101d17df0e55de3 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 23 Nov 2022 17:08:55 +0100 Subject: lib.types.net.ip*: add net-independent defaults --- lib/types.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/types.nix b/lib/types.nix index 0e0e093..67a0c6f 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -136,7 +136,7 @@ rec { default = null; }; ip4 = mkOption { - type = nullOr (submodule { + type = nullOr (submodule (ip4: { options = { addr = mkOption { type = addr4; @@ -146,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; @@ -163,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 { -- cgit v1.2.3 From 896d690725f6c01ceab04097c196b021b5ded639 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Dec 2022 00:28:58 +0100 Subject: lib.mapNixDir: admit just files with .nix suffix --- lib/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/default.nix b/lib/default.nix index 7c3b037..d65c891 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 + (name: type: + (type == "regular" && hasSuffix ".nix" name && name != "default.nix") || + (type == "directory" && !hasPrefix "." name)) + (readDir dirPath)))); # https://tools.ietf.org/html/rfc5952 normalize-ip6-addr = -- cgit v1.2.3 From a0b92d1c55c7c95283c99cd9021dacbd5a1c59d0 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Dec 2022 00:30:08 +0100 Subject: lib: add isNixDirEntry --- lib/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/default.nix b/lib/default.nix index d65c891..ad3a78a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -96,11 +96,11 @@ let in nameValuePair (toPackageName name) (f path)) (attrNames - (filterAttrs - (name: type: - (type == "regular" && hasSuffix ".nix" name && name != "default.nix") || - (type == "directory" && !hasPrefix "." name)) - (readDir dirPath)))); + (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 = -- cgit v1.2.3 From 219afe833756136e9541d187d3a6ce2a5258679a Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 9 Dec 2022 01:33:39 +0100 Subject: lib: add lib reference --- lib/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/default.nix b/lib/default.nix index ad3a78a..149b97a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -194,3 +194,4 @@ let in lib +// { inherit lib; } -- cgit v1.2.3