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: {