1 { config, lib, pkgs, ... }:
6 cfg = config.services.wg-netmanager;
11 services.wg-netmanager = {
12 enable = mkEnableOption "Wireguard network manager";
17 config = mkIf cfg.enable {
18 # NOTE: wg-netmanager runs as root
19 systemd.services.wg-netmanager = {
20 description = "Wireguard network manager";
21 wantedBy = [ "multi-user.target" ];
22 after = [ "network.target" ];
23 path = with pkgs; [ wireguard-tools iproute2 wireguard-go ];
26 Restart = "on-failure";
27 ExecStart = "${pkgs.wg-netmanager}/bin/wg_netmanager";
28 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
29 ExecStop = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
32 "/tmp" # wg-netmanager creates files in /tmp before deleting them after use
36 ConditionPathExists = ["/etc/wg_netmanager/network.yaml" "/etc/wg_netmanager/peer.yaml"];
41 meta.maintainers = with maintainers; [ gin66 ];