]> Git — Sourcephile - sourcephile-nix.git/blob - hosts/carotte/networking/wireguard/intranet.nix
hosts: add convenient switch script
[sourcephile-nix.git] / hosts / carotte / networking / wireguard / intranet.nix
1 { pkgs, lib, config, hostName, inputs, ... }:
2 let
3 inherit (config.security) gnupg;
4 iface = "wg-intra";
5 in
6 {
7 imports = [
8 (inputs.julm-nix + "/nixos/profiles/wireguard/wg-intra.nix")
9 ];
10 networking.wireguard.interfaces.${iface} = {
11 privateKeyFile = gnupg.secrets."wireguard/${iface}/privateKey".path;
12 };
13 security.gnupg.secrets."wireguard/${iface}/privateKey" = {
14 /*
15 systemdConfig.serviceConfig = {
16 before = [ "wireguard-${iface}.service" ];
17 wantedBy = [ "wireguard-${iface}.service" ];
18 requiredBy = [ "wireguard-${iface}.service" ];
19 };
20 */
21 };
22 systemd.services."wireguard-${iface}" = {
23 after = [ gnupg.secrets."wireguard/${iface}/privateKey".service ];
24 requires = [ gnupg.secrets."wireguard/${iface}/privateKey".service ];
25 };
26 }