service.nix (986B)
1 { 2 liminix 3 , dnsmasq 4 , serviceFns 5 , lib 6 }: 7 { 8 interface 9 , user 10 , domain 11 , group 12 , ranges 13 , upstreams 14 , resolvconf 15 }: 16 let 17 name = "${interface.device}.dnsmasq"; 18 inherit (liminix.services) longrun; 19 inherit (lib) concatStringsSep; 20 in 21 longrun { 22 inherit name; 23 dependencies = [ interface ]; 24 run = '' 25 . ${serviceFns} 26 ${dnsmasq}/bin/dnsmasq \ 27 --user=${user} \ 28 --domain=${domain} \ 29 --group=${group} \ 30 --interface=${interface.device} \ 31 ${lib.concatStringsSep " " (builtins.map (r: "--dhcp-range=${r}") ranges)} \ 32 ${lib.concatStringsSep " " (builtins.map (r: "--server=${r}") upstreams)} \ 33 --keep-in-foreground \ 34 --dhcp-authoritative \ 35 ${if resolvconf != null then "--resolv-file=$(output_path ${resolvconf} resolv.conf)" else "--no-resolv"} \ 36 --no-hosts \ 37 --log-dhcp \ 38 --enable-ra \ 39 --log-debug \ 40 --log-queries \ 41 --log-facility=- \ 42 --dhcp-leasefile=/run/${name}.leases \ 43 --pid-file=/run/${name}.pid 44 ''; 45 }