mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-30 22:21:26 +00:00
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";
|
||||
|
||||
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 = [
|
||||
@ -138,11 +145,11 @@ in {
|
||||
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"
|
||||
|
@ -42,7 +42,7 @@ in import ./make-test-python.nix ({ pkgs, ...} : {
|
||||
|
||||
services.yggdrasil = {
|
||||
enable = true;
|
||||
config = {
|
||||
settings = {
|
||||
Listen = ["tcp://0.0.0.0:12345"];
|
||||
MulticastInterfaces = [ ];
|
||||
};
|
||||
@ -112,7 +112,7 @@ in import ./make-test-python.nix ({ pkgs, ...} : {
|
||||
services.yggdrasil = {
|
||||
enable = true;
|
||||
denyDhcpcdInterfaces = [ "ygg0" ];
|
||||
config = {
|
||||
settings = {
|
||||
IfTAPMode = true;
|
||||
IfName = "ygg0";
|
||||
MulticastInterfaces = [ "eth1" ];
|
||||
|
Loading…
Reference in New Issue
Block a user