diff options
| author | makefu <github@syntax-fehler.de> | 2021-11-24 08:27:30 +0100 | 
|---|---|---|
| committer | makefu <github@syntax-fehler.de> | 2021-11-24 08:27:30 +0100 | 
| commit | aa7dd6c903cc9deb13b5ac1607ec9587b7c23e28 (patch) | |
| tree | a17ad7eb57224cf1f02960d08e4f1da52024a741 | |
| parent | 4572fc3e34c981df82767360ae06216d1cfe6f10 (diff) | |
| parent | 5dd979d54ca902ab317b6324ab8bdec67364b4e3 (diff) | |
Merge remote-tracking branch 'lass/master'
| -rw-r--r-- | lib/types.nix | 52 | 
1 files changed, 43 insertions, 9 deletions
| diff --git a/lib/types.nix b/lib/types.nix index 689a2c8..6755eef 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -34,7 +34,7 @@ rec {        ci = mkOption {          description = ''            If true, then the host wants to be tested by some CI system. -          See <stockholm/krebs/2configs/buildbot-all.nix> +          See ‹stockholm/krebs/2configs/buildbot-all.nix›          '';          type = bool;          default = false; @@ -43,7 +43,7 @@ rec {        external = mkOption {          description = ''            Whether the host is defined externally (in contrast to being defined -          in <stockholm>).  This is useful e.g. when legacy and/or adopted +          in ‹stockholm›).  This is useful e.g. when legacy and/or adopted            hosts should be part of retiolum or some other component.          '';          type = bool; @@ -102,7 +102,14 @@ rec {          default = config._module.args.name;        };        via = mkOption { -        type = nullOr net; +        type = +          # XXX break infinite recursion when generating manuals +          if config._module.args.name == "‹name›" then +            mkOptionType { +              name = "‹net›"; +            } +          else +            nullOr net;          default = null;        };        addrs = mkOption { @@ -128,9 +135,10 @@ rec {              };              prefix = mkOption ({                type = cidr4; -            } // optionalAttrs (config.name == "retiolum") { -              default = "10.243.0.0/16"; -            }); +            } // { +              retiolum.default = "10.243.0.0/16"; +              wiregrill.default = "10.244.0.0/16"; +            }.${config._module.args.name} or {});            };          });          default = null; @@ -144,9 +152,10 @@ rec {              };              prefix = mkOption ({                type = cidr6; -            } // optionalAttrs (config.name == "retiolum") { -              default = "42::/16"; -            }); +            } // { +              retiolum.default = "42:0::/32"; +              wiregrill.default = "42:1::/32"; +            }.${config._module.args.name} or {});            };          });          default = null; @@ -178,7 +187,15 @@ rec {                  [config.extraConfig]                  ++                  [config.pubkey] +                ++ +                optional (config.weight != null) "Weight = ${toString config.weight}"                ); +              defaultText = '' +                Address = ‹addr› ‹port› # for each ‹net.via.addrs› +                Subnet = ‹addr› # for each ‹net.addrs› +                ‹extraConfig› +                ‹pubkey› +              '';              };              pubkey = mkOption {                type = tinc-pubkey; @@ -202,6 +219,15 @@ rec {                description = "tinc subnets";                default = [];              }; +            weight = mkOption { +              type = nullOr int; +              description = '' +                global tinc weight (latency in ms) of this particular node. +                can be set to some high value to make it unprobable to be used as router. +                if set to null, tinc will autogenerate the value based on latency. +              ''; +              default = if net.via != null then null else 300; +            };            };          }));          default = null; @@ -227,6 +253,7 @@ rec {              };            };          })); +        default = null;        };      };    }); @@ -252,6 +279,7 @@ rec {        path = mkOption {          type = absolute-pathname;          default = "/run/keys/${config.name}"; +        defaultText = "/run/keys/‹name›";        };        mode = mkOption {          type = file-mode; @@ -267,10 +295,12 @@ rec {        service = mkOption {          type = systemd.unit-name;          default = "secret-${lib.systemd.encodeName config.name}.service"; +        defaultText = "secret-‹name›.service";        };        source-path = mkOption {          type = str;          default = toString <secrets> + "/${config.name}"; +        defaultText = "‹secrets/‹name››";        };      };    }); @@ -379,6 +409,7 @@ rec {        home = mkOption {          type = absolute-pathname;          default = "/home/${config.name}"; +        defaultText = "/home/‹name›";        };        mail = mkOption {          type = nullOr str; @@ -406,6 +437,7 @@ rec {        uid = mkOption {          type = int;          default = genid_uint31 config.name; +        defaultText = "genid_uint31 ‹name›";        };      };    }); @@ -414,10 +446,12 @@ rec {        name = mkOption {          type = username;          default = config._module.args.name; +        defaultText = "genid_uint31 ‹name›";        };        gid = mkOption {          type = int;          default = genid_uint31 config.name; +        defaultText = "genid_uint31 ‹name›";        };      };    }); | 
