mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
levi: add wireguard
This commit is contained in:
parent
196483417f
commit
f950d3c26b
2 changed files with 17 additions and 5 deletions
|
@ -37,7 +37,7 @@ in
|
|||
profile = "desktop";
|
||||
gaming.enable = true;
|
||||
horizon.enable = true;
|
||||
wg-home.enable = true;
|
||||
wg-home = { enable = true; path = "${persist}/wireguard_home.conf"; };
|
||||
};
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sconfig.wg-home;
|
||||
in
|
||||
{
|
||||
options.sconfig.wg-home.enable = lib.mkEnableOption "set up home VPN";
|
||||
options.sconfig.wg-home = {
|
||||
|
||||
config = lib.mkIf config.sconfig.wg-home.enable {
|
||||
enable = lib.mkEnableOption "set up home VPN";
|
||||
|
||||
path = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/nixos/wireguard_home.conf";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.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";
|
||||
script = "wg-quick up ${cfg.path}";
|
||||
preStop = "wg-quick down ${cfg.path}";
|
||||
path = [ pkgs.wireguard-tools ];
|
||||
serviceConfig = {
|
||||
type = "oneshot";
|
||||
|
|
Loading…
Reference in a new issue