add dnsmasq and example config for it

would be good to move more of this into a module, but that
doesn't sit well with the (potential) ability to run more than one
dnsmasq service, as modules are singletons
This commit is contained in:
Daniel Barlow
2022-09-28 21:33:18 +01:00
parent 6f23a45696
commit c320d0afc7
7 changed files with 175 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{ config, pkgs, ... } :
{ config, pkgs, lib, ... } :
let
inherit (pkgs.liminix.networking) interface address pppoe route;
inherit (pkgs.liminix.networking) interface address pppoe route dnsmasq;
inherit (pkgs.liminix.services) oneshot longrun bundle target output;
in rec {
services.loopback =
@@ -13,6 +13,10 @@ in rec {
];
};
services.lan4 =
let iface = interface { type = "hardware"; device = "eth1";};
in address iface { family = "inet4"; address ="192.168.19.1"; prefixLength = 24;};
kernel.config = {
"IKCONFIG_PROC" = "y";
"PPP" = "y";
@@ -53,14 +57,29 @@ in rec {
dependencies = [iface];
};
users.dnsmasq = {
uid = 51; gid= 51; gecos = "DNS/DHCP service user";
dir = "/run/dnsmasq";
shell = "/bin/false";
};
groups.dnsmasq = {
gid = 51; usernames = ["dnsmasq"];
};
services.dns =
dnsmasq {
interface = services.lan4;
ranges = ["192.168.19.10,192.168.19.253"];
domain = "fake.liminix.org";
};
services.default = target {
name = "default";
contents = with services; [
loopback
defaultroute4
packet_forwarding
dns
];
};
defaultProfile.packages = [ pkgs.hello ] ;
}