modules/nixos/wireguard-dns: Init

This commit is contained in:
kat witch 2021-09-07 04:14:08 +01:00
parent 70d95acddb
commit 027c0012de
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
9 changed files with 57 additions and 35 deletions

View file

@ -0,0 +1,15 @@
{ config, lib, ... }: with lib; let
cfg = config.network;
wgcfg = config.network.wireguard;
magic = toString wgcfg.magicNumber;
in {
network.addresses.wireguard = {
enable = config.network.wireguard.enable;
nixos = {
ipv4.address = "${wgcfg.prefixV4}.${magic}";
ipv6.address = "${wgcfg.prefixV6}:${magic}";
};
prefix = "wg";
subdomain = "${config.networking.hostName}.${cfg.addresses.wireguard.prefix}";
};
}

View file

@ -14,7 +14,7 @@ in
magicNumber = mkOption { type = types.ints.u8; };
prefixV4 = mkOption {
type = types.str;
default = "172.23.1";
default = "10.42.69";
};
prefixV6 = mkOption {
type = types.str;