67 lines
1.2 KiB
Nix
67 lines
1.2 KiB
Nix
let
|
|
lib = import <nixpkgs/lib>;
|
|
in
|
|
rec {
|
|
network = {
|
|
subnet = "192.168.2.0/24";
|
|
subnet_base = "192.168.2.0";
|
|
gateway = ips.router;
|
|
cidr = 24;
|
|
};
|
|
|
|
ips = {
|
|
pi = "192.168.2.100";
|
|
desktop = "192.168.2.101";
|
|
router = "192.168.2.1";
|
|
};
|
|
|
|
dhcp = {
|
|
pool_start = "192.168.2.50";
|
|
pool_end = "192.168.2.90";
|
|
default_lease = 3600;
|
|
max_lease = 86400;
|
|
reservations = [{
|
|
ip-address = ips.desktop;
|
|
hw-address = "30:9c:23:81:91:ea";
|
|
hostname = "desktop";
|
|
}];
|
|
};
|
|
|
|
fallback_dns_servers = [
|
|
"1.1.1.1"
|
|
"8.8.8.8"
|
|
];
|
|
|
|
local_domain = "home";
|
|
|
|
services = {
|
|
"pi" = {
|
|
ip = ips.pi;
|
|
};
|
|
"desktop" = {
|
|
ip = ips.desktop;
|
|
};
|
|
"torrent" = {
|
|
ip = ips.pi;
|
|
reverse_proxy = {
|
|
port = 8085;
|
|
};
|
|
};
|
|
"wiki" = {
|
|
ip = ips.pi;
|
|
reverse_proxy = {
|
|
port = 8086;
|
|
};
|
|
};
|
|
"router" = {
|
|
ip = ips.router;
|
|
};
|
|
};
|
|
|
|
dnsMappings = builtins.listToAttrs (map (name: {
|
|
name = "${name}.${local_domain}";
|
|
value = services.${name}.ip;
|
|
}) (builtins.attrNames services));
|
|
|
|
reverse_proxy = lib.filterAttrs (name: value: value ? reverse_proxy) services;
|
|
}
|