diff options
author | makefu <makefu@nixos.dev> | 2016-05-02 16:08:30 +0200 |
---|---|---|
committer | makefu <makefu@nixos.dev> | 2016-05-02 16:08:30 +0200 |
commit | 64aa4f6912fb7425d8063e5d143f59c43fb31b8f (patch) | |
tree | 07fe7c386d32bd5e1375a7d01f623cd357a1d09d /krebs/4lib | |
parent | 3f77b6c89f4a3a28d62e9117712481489ac56fa1 (diff) | |
parent | 6f4bc4b34c3cbac56f6a23740dca566980823990 (diff) |
Merge branch 'master' of gum:stockholm
Diffstat (limited to 'krebs/4lib')
-rw-r--r-- | krebs/4lib/types.nix | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index 32d1daf9d..7255dc3e1 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -186,10 +186,16 @@ types // rec { }; }); - # TODO - addr = str; - addr4 = str; - addr6 = str; + addr = either addr4 addr6; + addr4 = mkOptionType { + name = "IPv4 address"; + check = let + IPv4address = let d = "([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"; in + concatMapStringsSep "." (const d) (range 1 4); + in x: match IPv4address != null; + merge = mergeOneOption; + }; + addr6 = str; # TODO pgp-pubkey = str; |