From db6e5d38281f3b442be5e4ebf2604e57d7bcef20 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 7 Aug 2024 09:14:26 +0200 Subject: [PATCH] update wg1 scripts --- machines/cherry/network-wireguard-wg1.nix | 9 ++++++--- machines/cream/network-wireguard-wg1.nix | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/machines/cherry/network-wireguard-wg1.nix b/machines/cherry/network-wireguard-wg1.nix index 88e3c67..3dc6481 100644 --- a/machines/cherry/network-wireguard-wg1.nix +++ b/machines/cherry/network-wireguard-wg1.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, config, ... }: { clan.core.facts.services.wg1 = { secret."wg1.conf" = { }; @@ -12,9 +12,12 @@ ''; }; }; - home-manager.users.root.packages = [ - (pkgs.writers.writeBashBin "wg1-connect" '' + home-manager.users.root.home.packages = [ + (pkgs.writers.writeBashBin "wg1-up" '' ${pkgs.wireguard-tools}/bin/wg-quick up ${config.clan.core.facts.services.wg1.secret."wg1.conf".path} '') + (pkgs.writers.writeBashBin "wg1-down" '' + ${pkgs.wireguard-tools}/bin/wg-quick down ${config.clan.core.facts.services.wg1.secret."wg1.conf".path} + '') ]; } diff --git a/machines/cream/network-wireguard-wg1.nix b/machines/cream/network-wireguard-wg1.nix index 88e3c67..948c210 100644 --- a/machines/cream/network-wireguard-wg1.nix +++ b/machines/cream/network-wireguard-wg1.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, config, ... }: { clan.core.facts.services.wg1 = { secret."wg1.conf" = { }; @@ -12,8 +12,11 @@ ''; }; }; - home-manager.users.root.packages = [ - (pkgs.writers.writeBashBin "wg1-connect" '' + home-manager.users.root.home.packages = [ + (pkgs.writers.writeBashBin "wg1-up" '' + ${pkgs.wireguard-tools}/bin/wg-quick up ${config.clan.core.facts.services.wg1.secret."wg1.conf".path} + '') + (pkgs.writers.writeBashBin "wg1-down" '' ${pkgs.wireguard-tools}/bin/wg-quick up ${config.clan.core.facts.services.wg1.secret."wg1.conf".path} '') ];