11 cfg = config.services.wg-netmanager;
16 services.wg-netmanager = {
17 enable = mkEnableOption "Wireguard network manager";
22 config = mkIf cfg.enable {
23 # NOTE: wg-netmanager runs as root
24 systemd.services.wg-netmanager = {
25 description = "Wireguard network manager";
26 wantedBy = [ "multi-user.target" ];
27 after = [ "network.target" ];
35 Restart = "on-failure";
36 ExecStart = "${pkgs.wg-netmanager}/bin/wg_netmanager";
37 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
38 ExecStop = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
41 "/tmp" # wg-netmanager creates files in /tmp before deleting them after use
45 ConditionPathExists = [
46 "/etc/wg_netmanager/network.yaml"
47 "/etc/wg_netmanager/peer.yaml"
53 meta.maintainers = with maintainers; [ gin66 ];