summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2019-04-29 18:09:33 +0300
committerNikolay Amiantov <ab@fmap.me>2019-05-25 11:17:36 +0300
commitcfadd988e5795771c3a59de88f5838b0bcaa3040 (patch)
tree730b471a14fc816dd65ab2f29fbce38fd39c2657 /nixos
parent971b731fc18c86569211a460ef62e1d8001799e9 (diff)
downloadnixpkgs-cfadd988e5795771c3a59de88f5838b0bcaa3040.tar
nixpkgs-cfadd988e5795771c3a59de88f5838b0bcaa3040.tar.gz
nixpkgs-cfadd988e5795771c3a59de88f5838b0bcaa3040.tar.bz2
nixpkgs-cfadd988e5795771c3a59de88f5838b0bcaa3040.tar.lz
nixpkgs-cfadd988e5795771c3a59de88f5838b0bcaa3040.tar.xz
nixpkgs-cfadd988e5795771c3a59de88f5838b0bcaa3040.tar.zst
nixpkgs-cfadd988e5795771c3a59de88f5838b0bcaa3040.zip
wireguard service: allow empty interfaces
This is needed in case one wants to use wg-quick on NixOS.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/wireguard.nix12
1 files 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: {