2022-05-11 15:50:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
|
|
|
options.sconfig.wg-home.enable = lib.mkEnableOption "set up home VPN";
|
|
|
|
|
|
|
|
config = lib.mkIf config.sconfig.wg-home.enable {
|
|
|
|
systemd.services.wg-home = {
|
2022-07-25 02:11:25 +00:00
|
|
|
script = "wg-quick up /var/lib/nixos/wireguard_home.conf";
|
|
|
|
preStop = "wg-quick down /var/lib/nixos/wireguard_home.conf";
|
2022-05-11 15:50:52 +00:00
|
|
|
path = [ pkgs.wireguard-tools ];
|
|
|
|
serviceConfig = {
|
|
|
|
type = "oneshot";
|
|
|
|
RemainAfterExit = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
boot.kernelModules = [ "wireguard" ];
|
|
|
|
environment.systemPackages = [ pkgs.wireguard-tools ];
|
|
|
|
};
|
|
|
|
}
|