From cfadd988e5795771c3a59de88f5838b0bcaa3040 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 29 Apr 2019 18:09:33 +0300 Subject: [PATCH] wireguard service: allow empty interfaces This is needed in case one wants to use wg-quick on NixOS. --- nixos/modules/services/networking/wireguard.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/wireguard.nix b/nixos/modules/services/networking/wireguard.nix index dd3cb1af271..adbbc5fc05a 100644 --- a/nixos/modules/services/networking/wireguard.nix +++ b/nixos/modules/services/networking/wireguard.nix @@ -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: {