mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 20:39:18 -08:00
modules/nixos/wireguard-dns: Init
This commit is contained in:
parent
70d95acddb
commit
027c0012de
9 changed files with 57 additions and 35 deletions
15
config/modules/nixos/wireguard-dns.nix
Normal file
15
config/modules/nixos/wireguard-dns.nix
Normal 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}";
|
||||
};
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue