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
This commit is contained in:
parent
2e7384b7df
commit
300c5c98c6
|
@ -4,16 +4,23 @@ let
|
||||||
keysPath = "/var/lib/yggdrasil/keys.json";
|
keysPath = "/var/lib/yggdrasil/keys.json";
|
||||||
|
|
||||||
cfg = config.services.yggdrasil;
|
cfg = config.services.yggdrasil;
|
||||||
configProvided = cfg.config != { };
|
settingsProvided = cfg.settings != { };
|
||||||
configFileProvided = cfg.configFile != null;
|
configFileProvided = cfg.configFile != null;
|
||||||
|
|
||||||
|
format = pkgs.formats.json { };
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkRenamedOptionModule
|
||||||
|
[ "services" "yggdrasil" "config" ]
|
||||||
|
[ "services" "yggdrasil" "settings" ])
|
||||||
|
];
|
||||||
|
|
||||||
options = with types; {
|
options = with types; {
|
||||||
services.yggdrasil = {
|
services.yggdrasil = {
|
||||||
enable = mkEnableOption "the yggdrasil system service";
|
enable = mkEnableOption "the yggdrasil system service";
|
||||||
|
|
||||||
config = mkOption {
|
settings = mkOption {
|
||||||
type = attrs;
|
type = format.type;
|
||||||
default = {};
|
default = {};
|
||||||
example = {
|
example = {
|
||||||
Peers = [
|
Peers = [
|
||||||
|
@ -138,11 +145,11 @@ in {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
preStart =
|
preStart =
|
||||||
(if configProvided || configFileProvided || cfg.persistentKeys then
|
(if settingsProvided || configFileProvided || cfg.persistentKeys then
|
||||||
"echo "
|
"echo "
|
||||||
|
|
||||||
+ (lib.optionalString configProvided
|
+ (lib.optionalString settingsProvided
|
||||||
"'${builtins.toJSON cfg.config}'")
|
"'${builtins.toJSON cfg.settings}'")
|
||||||
+ (lib.optionalString configFileProvided "$(cat ${cfg.configFile})")
|
+ (lib.optionalString configFileProvided "$(cat ${cfg.configFile})")
|
||||||
+ (lib.optionalString cfg.persistentKeys "$(cat ${keysPath})")
|
+ (lib.optionalString cfg.persistentKeys "$(cat ${keysPath})")
|
||||||
+ " | ${pkgs.jq}/bin/jq -s add | ${binYggdrasil} -normaliseconf -useconf"
|
+ " | ${pkgs.jq}/bin/jq -s add | ${binYggdrasil} -normaliseconf -useconf"
|
||||||
|
|
|
@ -42,7 +42,7 @@ in import ./make-test-python.nix ({ pkgs, ...} : {
|
||||||
|
|
||||||
services.yggdrasil = {
|
services.yggdrasil = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
settings = {
|
||||||
Listen = ["tcp://0.0.0.0:12345"];
|
Listen = ["tcp://0.0.0.0:12345"];
|
||||||
MulticastInterfaces = [ ];
|
MulticastInterfaces = [ ];
|
||||||
};
|
};
|
||||||
|
@ -112,7 +112,7 @@ in import ./make-test-python.nix ({ pkgs, ...} : {
|
||||||
services.yggdrasil = {
|
services.yggdrasil = {
|
||||||
enable = true;
|
enable = true;
|
||||||
denyDhcpcdInterfaces = [ "ygg0" ];
|
denyDhcpcdInterfaces = [ "ygg0" ];
|
||||||
config = {
|
settings = {
|
||||||
IfTAPMode = true;
|
IfTAPMode = true;
|
||||||
IfName = "ygg0";
|
IfName = "ygg0";
|
||||||
MulticastInterfaces = [ "eth1" ];
|
MulticastInterfaces = [ "eth1" ];
|
||||||
|
|
Loading…
Reference in a new issue