diff --git a/machines/cherry/configuration.nix b/machines/cherry/configuration.nix index 64be479..46c7abd 100644 --- a/machines/cherry/configuration.nix +++ b/machines/cherry/configuration.nix @@ -13,7 +13,8 @@ ./network-tinc.nix ./network-tinc_retiolum.nix - ./network-wireguard.nix + ./network-wireguard-wg0.nix + ./network-wireguard-wg0.nix ./37c3.nix diff --git a/machines/cherry/network-wireguard.nix b/machines/cherry/network-wireguard-wg0.nix similarity index 100% rename from machines/cherry/network-wireguard.nix rename to machines/cherry/network-wireguard-wg0.nix diff --git a/machines/cherry/network-wireguard-wg1.nix b/machines/cherry/network-wireguard-wg1.nix new file mode 100644 index 0000000..88e3c67 --- /dev/null +++ b/machines/cherry/network-wireguard-wg1.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: +{ + clan.core.facts.services.wg1 = { + secret."wg1.conf" = { }; + generator = { + # I download the config from my fritz.box + # cat wg_config.conf | pass insert -m machiens//wg1.conf + prompt = "please enter the wg1.conf"; + path = with pkgs; [ coreutils ]; + script = '' + echo "$prompt_value" > "$secrets"/wg1.conf + ''; + }; + }; + home-manager.users.root.packages = [ + (pkgs.writers.writeBashBin "wg1-connect" '' + ${pkgs.wireguard-tools}/bin/wg-quick up ${config.clan.core.facts.services.wg1.secret."wg1.conf".path} + '') + ]; +} diff --git a/machines/cream/configuration.nix b/machines/cream/configuration.nix index e08f6e1..33ed5a9 100644 --- a/machines/cream/configuration.nix +++ b/machines/cream/configuration.nix @@ -13,7 +13,8 @@ ./network-tinc.nix ./network-tinc_retiolum.nix - ./network-wireguard.nix + ./network-wireguard-wg0.nix + ./network-wireguard-wg1.nix ]; diff --git a/machines/cream/network-wireguard.nix b/machines/cream/network-wireguard-wg0.nix similarity index 100% rename from machines/cream/network-wireguard.nix rename to machines/cream/network-wireguard-wg0.nix diff --git a/machines/cream/network-wireguard-wg1.nix b/machines/cream/network-wireguard-wg1.nix new file mode 100644 index 0000000..88e3c67 --- /dev/null +++ b/machines/cream/network-wireguard-wg1.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: +{ + clan.core.facts.services.wg1 = { + secret."wg1.conf" = { }; + generator = { + # I download the config from my fritz.box + # cat wg_config.conf | pass insert -m machiens//wg1.conf + prompt = "please enter the wg1.conf"; + path = with pkgs; [ coreutils ]; + script = '' + echo "$prompt_value" > "$secrets"/wg1.conf + ''; + }; + }; + home-manager.users.root.packages = [ + (pkgs.writers.writeBashBin "wg1-connect" '' + ${pkgs.wireguard-tools}/bin/wg-quick up ${config.clan.core.facts.services.wg1.secret."wg1.conf".path} + '') + ]; +}