2025-07-01 04:11:32 -05:00
|
|
|
{ config, flake, ... }:
|
|
|
|
let
|
2025-07-06 13:35:31 -05:00
|
|
|
inherit (flake.config.services.instances) wireGuard;
|
|
|
|
inherit (flake.config.machines.devices) mars;
|
2025-07-01 04:11:32 -05:00
|
|
|
service = wireGuard;
|
|
|
|
in
|
|
|
|
{
|
2025-07-01 16:08:54 -05:00
|
|
|
networking = {
|
|
|
|
wireguard.interfaces = {
|
|
|
|
wg0 = {
|
|
|
|
ips = [ "${mars.wireguard.ip0}/32" ];
|
|
|
|
privateKeyFile = config.sops.secrets."${service.name}-mars-private".path;
|
|
|
|
};
|
2025-07-01 04:11:32 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
sops =
|
|
|
|
let
|
|
|
|
sopsPath = secret: {
|
|
|
|
path = "${service.sops.path0}/${service.name}-${secret}-pass";
|
|
|
|
owner = "root";
|
|
|
|
mode = "600";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
secrets = builtins.listToAttrs (
|
|
|
|
map
|
|
|
|
(secret: {
|
|
|
|
name = "${service.name}-${secret}";
|
|
|
|
value = sopsPath secret;
|
|
|
|
})
|
|
|
|
[
|
|
|
|
"mars-private"
|
|
|
|
"mars-public"
|
|
|
|
]
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|