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>
This commit is contained in:
parent
216b4f1813
commit
b4c2ffaffa
@ -17,6 +17,13 @@ let
|
|||||||
description = "The IP addresses of the interface.";
|
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 {
|
dns = mkOption {
|
||||||
example = [ "192.168.2.2" ];
|
example = [ "192.168.2.2" ];
|
||||||
default = [];
|
default = [];
|
||||||
@ -247,7 +254,7 @@ let
|
|||||||
description = "wg-quick WireGuard Tunnel - ${name}";
|
description = "wg-quick WireGuard Tunnel - ${name}";
|
||||||
requires = [ "network-online.target" ];
|
requires = [ "network-online.target" ];
|
||||||
after = [ "network.target" "network-online.target" ];
|
after = [ "network.target" "network-online.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = optional values.autostart "multi-user.target";
|
||||||
environment.DEVICE = name;
|
environment.DEVICE = name;
|
||||||
path = [ pkgs.kmod pkgs.wireguard-tools ];
|
path = [ pkgs.kmod pkgs.wireguard-tools ];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user