add wireguard VPN

This commit is contained in:
Sean Buckley 2022-05-11 11:50:52 -04:00
parent 4c4f5a015c
commit 9e1e8410c3
3 changed files with 20 additions and 0 deletions

View file

@ -24,6 +24,7 @@
gnome = true;
profile = "desktop";
horizon.enable = true;
wg-home.enable = true;
};
boot = {

View file

@ -24,6 +24,7 @@
gnome = true;
profile = "desktop";
horizon.enable = true;
wg-home.enable = true;
};
zramSwap.memoryPercent = 100;

18
modules/wg-home.nix Normal file
View file

@ -0,0 +1,18 @@
{ 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 ];
};
}