mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 23:54:01 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
43 lines
1.1 KiB
Nix
43 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.wg-netmanager;
|
|
in
|
|
{
|
|
|
|
options = {
|
|
services.wg-netmanager = {
|
|
enable = mkEnableOption "Wireguard network manager";
|
|
};
|
|
};
|
|
|
|
###### implementation
|
|
config = mkIf cfg.enable {
|
|
# NOTE: wg-netmanager runs as root
|
|
systemd.services.wg-netmanager = {
|
|
description = "Wireguard network manager";
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network.target" ];
|
|
path = with pkgs; [ wireguard-tools iproute2 wireguard-go ];
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
Restart = "on-failure";
|
|
ExecStart = "${pkgs.wg-netmanager}/bin/wg_netmanager";
|
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
|
ExecStop = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
|
|
|
ReadWritePaths = [
|
|
"/tmp" # wg-netmanager creates files in /tmp before deleting them after use
|
|
];
|
|
};
|
|
unitConfig = {
|
|
ConditionPathExists = ["/etc/wg_netmanager/network.yaml" "/etc/wg_netmanager/peer.yaml"];
|
|
};
|
|
};
|
|
};
|
|
|
|
meta.maintainers = with maintainers; [ gin66 ];
|
|
}
|