mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
19 lines
563 B
Nix
19 lines
563 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 /nix/persist/wireguard_home.conf";
|
||
|
preStop = "wg-quick down /nix/persist/wireguard_home.conf";
|
||
|
path = [ pkgs.wireguard-tools ];
|
||
|
serviceConfig = {
|
||
|
type = "oneshot";
|
||
|
RemainAfterExit = true;
|
||
|
};
|
||
|
};
|
||
|
boot.kernelModules = [ "wireguard" ];
|
||
|
environment.systemPackages = [ pkgs.wireguard-tools ];
|
||
|
};
|
||
|
}
|