Setup static IP support in dhcpd

Signed-off-by: main <magic_rb@redalder.org>
This commit is contained in:
main 2022-12-21 23:19:13 +01:00
parent 2852b5f562
commit b1381511dd
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
2 changed files with 21 additions and 11 deletions

View file

@ -37,6 +37,14 @@ in
media = mkIpOption;
};
network.dhcpd.blowhole = mkOption {
description = ''
Secret config specific to blowhole's dhcpcd.
'';
type = types.str;
default = "";
};
network.networks = {
home.inner = mkNetworkOption;
home.outer = mkNetworkOption;

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }:
{ pkgs, secret, config, lib, ... }:
with lib;
let
lan = "enp7s0f0";
@ -15,7 +15,7 @@ in
imports = [
(_: {
systemd.services =
listToAttrs (flip map config.magic_rb.secret.wireguard."${config.networking.hostName}".peers or {}
listToAttrs (flip map config.magic_rb.secret.wireguard."${config.networking.hostName}".peers or []
(v:
let
peerUnitServiceName = interfaceName: publicKey: dynamicRefreshEnabled:
@ -99,16 +99,18 @@ in
enable = true;
interfaces = [ "${lan}" ];
extraConfig = ''
option domain-name-servers 10.64.2.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 10.64.2.1;
option subnet-mask 255.255.255.0;
subnet 10.64.2.0 netmask 255.255.255.0 {
option broadcast-address 10.64.2.255;
option routers 10.64.2.1;
interface ${lan};
range 10.64.2.128 10.64.2.254;
}
'';
subnet 10.64.2.0 netmask 255.255.255.0 {
option broadcast-address 10.64.2.255;
option routers 10.64.2.1;
interface ${lan};
range 10.64.2.128 10.64.2.254;
${secret.network.dhcpd.blowhole}
}
'';
};
# systemd.services.dns-check = {