diff options
author | Sivizius <sivizius@ohai.su> | 2022-03-22 14:25:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 13:25:57 +0000 |
commit | b4c2ffaffa600ffce2121e21f65641ec92955781 (patch) | |
tree | 38b05ac36c10fff78973e97ad89780947d9b8bc9 /nixos/modules | |
parent | 216b4f181379ad704b6102eef4ad36b4a18b2d30 (diff) | |
download | nixlib-b4c2ffaffa600ffce2121e21f65641ec92955781.tar nixlib-b4c2ffaffa600ffce2121e21f65641ec92955781.tar.gz nixlib-b4c2ffaffa600ffce2121e21f65641ec92955781.tar.bz2 nixlib-b4c2ffaffa600ffce2121e21f65641ec92955781.tar.lz nixlib-b4c2ffaffa600ffce2121e21f65641ec92955781.tar.xz nixlib-b4c2ffaffa600ffce2121e21f65641ec92955781.tar.zst nixlib-b4c2ffaffa600ffce2121e21f65641ec92955781.zip |
nixos/wg-quick: add autostart option to interfaces (#162219)
This adds the option `networking.wg-quick.interfaces.<name>.autostart`, which defaults to `true`, which is the previous behavior. With this option set to `false`, the systemd-unit will no longer be set to `wantedBy = [ "multi-user.target" ]` and therefore the tunnel has to be enabled/disabled via `systemctl start/stop wg-quick-<name>`. Co-authored-by: pennae <82953136+pennae@users.noreply.github.com>
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/networking/wg-quick.nix | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/wg-quick.nix b/nixos/modules/services/networking/wg-quick.nix index 414775fc3577..61e9fe5096b1 100644 --- a/nixos/modules/services/networking/wg-quick.nix +++ b/nixos/modules/services/networking/wg-quick.nix @@ -17,6 +17,13 @@ let description = "The IP addresses of the interface."; }; + autostart = mkOption { + description = "Whether to bring up this interface automatically during boot."; + default = true; + example = false; + type = types.bool; + }; + dns = mkOption { example = [ "192.168.2.2" ]; default = []; @@ -247,7 +254,7 @@ let description = "wg-quick WireGuard Tunnel - ${name}"; requires = [ "network-online.target" ]; after = [ "network.target" "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; + wantedBy = optional values.autostart "multi-user.target"; environment.DEVICE = name; path = [ pkgs.kmod pkgs.wireguard-tools ]; |