mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
18 lines
567 B
Nix
18 lines
567 B
Nix
{ 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 = {
|
|
script = "wg-quick up /var/lib/nixos/wireguard_home.conf";
|
|
preStop = "wg-quick down /var/lib/nixos/wireguard_home.conf";
|
|
path = [ pkgs.wireguard-tools ];
|
|
serviceConfig = {
|
|
type = "oneshot";
|
|
RemainAfterExit = true;
|
|
};
|
|
};
|
|
boot.kernelModules = [ "wireguard" ];
|
|
environment.systemPackages = [ pkgs.wireguard-tools ];
|
|
};
|
|
}
|