mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-08 13:59:24 -06:00
39 lines
817 B
Nix
39 lines
817 B
Nix
|
|
{ config, flake, ... }:
|
||
|
|
let
|
||
|
|
inherit (flake.config.services.instances) wireGuard;
|
||
|
|
inherit (flake.config.machines.devices) mars;
|
||
|
|
service = wireGuard;
|
||
|
|
in
|
||
|
|
{
|
||
|
|
networking = {
|
||
|
|
wireguard.interfaces = {
|
||
|
|
wg0 = {
|
||
|
|
ips = [ "${mars.wireguard.ip0}/32" ];
|
||
|
|
privateKeyFile = config.sops.secrets."${service.name}-mars-private".path;
|
||
|
|
};
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
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"
|
||
|
|
]
|
||
|
|
);
|
||
|
|
};
|
||
|
|
}
|