nixos-config/machines/cream/network-wireguard-wg1.nix
2024-08-07 08:14:16 +02:00

20 lines
600 B
Nix

{ 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/<name>/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}
'')
];
}