mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
add wireguard VPN
This commit is contained in:
parent
4c4f5a015c
commit
9e1e8410c3
3 changed files with 20 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
||||||
gnome = true;
|
gnome = true;
|
||||||
profile = "desktop";
|
profile = "desktop";
|
||||||
horizon.enable = true;
|
horizon.enable = true;
|
||||||
|
wg-home.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
gnome = true;
|
gnome = true;
|
||||||
profile = "desktop";
|
profile = "desktop";
|
||||||
horizon.enable = true;
|
horizon.enable = true;
|
||||||
|
wg-home.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
zramSwap.memoryPercent = 100;
|
zramSwap.memoryPercent = 100;
|
||||||
|
|
18
modules/wg-home.nix
Normal file
18
modules/wg-home.nix
Normal 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 ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue