wireguard service: allow empty interfaces

This is needed in case one wants to use wg-quick on NixOS.
This commit is contained in:
Nikolay Amiantov 2019-04-29 18:09:33 +03:00
parent 971b731fc1
commit cfadd988e5

View File

@ -301,8 +301,16 @@ in
networking.wireguard = {
enable = mkOption {
description = "Whether to enable WireGuard.";
type = types.bool;
# 2019-05-25: Backwards compatibility.
default = cfg.interfaces != {};
example = true;
};
interfaces = mkOption {
description = "Wireguard interfaces.";
description = "WireGuard interfaces.";
default = {};
example = {
wg0 = {
@ -325,7 +333,7 @@ in
###### implementation
config = mkIf (cfg.interfaces != {}) {
config = mkIf cfg.enable {
assertions = (attrValues (
mapAttrs (name: value: {