50 lines
1.3 KiB
Nix
50 lines
1.3 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
activatedWg = name: {
|
|
networking.wg-quick.interfaces."${name}".configFile = "/persist/manual/wireguard/${name}.conf";
|
|
systemd.services."wg-quick-${name}" = {
|
|
after = [
|
|
"nss-lookup.target"
|
|
"systemd-resolved.service"
|
|
"multi-user.target"
|
|
];
|
|
preStart = "${pkgs.toybox}/bin/sleep 10";
|
|
};
|
|
# systemd.services."wg-quick-${name}".after = [
|
|
# "nss-lookup.target"
|
|
# "systemd-resolved.service"
|
|
# "multi-user.target"
|
|
# ];
|
|
# systemd.services."wg-quick-${name}".preStart = "${pkgs.toybox}/bin/sleep 10";
|
|
};
|
|
deactivatedWg = name: {
|
|
networking.wg-quick.interfaces."${name}" = {
|
|
configFile = "/persist/manual/wireguard/${name}.conf";
|
|
autostart = false;
|
|
};
|
|
};
|
|
wgConfig = lib.attrsets.recursiveUpdate (lib.attrsets.recursiveUpdate (lib.attrsets.recursiveUpdate
|
|
(lib.attrsets.recursiveUpdate {
|
|
networking.firewall.allowedUDPPorts = [ 51821 ];
|
|
networking.wireguard.enable = true;
|
|
} (activatedWg "drmario"))
|
|
(activatedWg "wgh")
|
|
) (activatedWg "colo")) (deactivatedWg "wgf");
|
|
in
|
|
{
|
|
imports = [ ];
|
|
|
|
config = lib.mkIf (!config.me.buildingIso) wgConfig;
|
|
|
|
# environment.systemPackages = with pkgs; [
|
|
# wireguard-tools
|
|
# ];
|
|
|
|
}
|