nixos/yggdrasil: rename "config" option to "settings"

Make this service consistent with rfc42.

https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md

Changed files
+15 -8
nixos
modules
services
networking
tests
+13 -6
nixos/modules/services/networking/yggdrasil.nix
···
keysPath = "/var/lib/yggdrasil/keys.json";
cfg = config.services.yggdrasil;
-
configProvided = cfg.config != { };
+
settingsProvided = cfg.settings != { };
configFileProvided = cfg.configFile != null;
+
format = pkgs.formats.json { };
in {
+
imports = [
+
(mkRenamedOptionModule
+
[ "services" "yggdrasil" "config" ]
+
[ "services" "yggdrasil" "settings" ])
+
];
+
options = with types; {
services.yggdrasil = {
enable = mkEnableOption "the yggdrasil system service";
-
config = mkOption {
-
type = attrs;
+
settings = mkOption {
+
type = format.type;
default = {};
example = {
Peers = [
···
wantedBy = [ "multi-user.target" ];
preStart =
-
(if configProvided || configFileProvided || cfg.persistentKeys then
+
(if settingsProvided || configFileProvided || cfg.persistentKeys then
"echo "
-
+ (lib.optionalString configProvided
-
"'${builtins.toJSON cfg.config}'")
+
+ (lib.optionalString settingsProvided
+
"'${builtins.toJSON cfg.settings}'")
+ (lib.optionalString configFileProvided "$(cat ${cfg.configFile})")
+ (lib.optionalString cfg.persistentKeys "$(cat ${keysPath})")
+ " | ${pkgs.jq}/bin/jq -s add | ${binYggdrasil} -normaliseconf -useconf"
+2 -2
nixos/tests/yggdrasil.nix
···
services.yggdrasil = {
enable = true;
-
config = {
+
settings = {
Listen = ["tcp://0.0.0.0:12345"];
MulticastInterfaces = [ ];
};
···
services.yggdrasil = {
enable = true;
denyDhcpcdInterfaces = [ "ygg0" ];
-
config = {
+
settings = {
IfTAPMode = true;
IfName = "ygg0";
MulticastInterfaces = [ "eth1" ];