default.nix (3152B)
1 ## Dnsmasq 2 ## ======= 3 ## 4 ## This module includes a service to provide DNS, DHCP, and IPv6 5 ## router advertisement for the local network. 6 7 { 8 lib, 9 pkgs, 10 config, 11 ... 12 }: 13 let 14 inherit (lib) mkOption types; 15 inherit (pkgs) liminix; 16 in 17 { 18 imports = [ ../ipv6-autoconfig ]; 19 options = { 20 system.service.dnsmasq = mkOption { 21 type = liminix.lib.types.serviceDefn; 22 }; 23 }; 24 config = { 25 system.service.dnsmasq = config.system.callService ./service.nix { 26 user = mkOption { 27 type = types.str; 28 default = "dnsmasq"; 29 description = "Specifies the unix user which dnsmasq will run as"; 30 }; 31 group = mkOption { 32 type = types.str; 33 default = "dnsmasq"; 34 description = "Specifies the unix group which dnsmasq will run as"; 35 }; 36 resolvconf = mkOption { 37 type = types.nullOr liminix.lib.types.service; 38 default = null; 39 }; 40 interface = mkOption { 41 type = liminix.lib.types.service; 42 default = null; 43 }; 44 upstreams = mkOption { 45 type = types.listOf types.str; 46 default = [ ]; 47 }; 48 ranges = mkOption { 49 type = types.listOf types.str; 50 }; 51 hosts = mkOption { 52 default = { }; 53 type = types.attrsOf ( 54 types.submodule { 55 options = { 56 mac = mkOption { 57 description = '' 58 MAC or other hardware address to match on. For Ethernet 59 this is a 48 bit address represented as colon-separated 60 hex bytes, or "id:clientid" to match a presented 61 client id (IPv6 DUID) 62 ''; 63 type = types.str; 64 example = "01:20:31:4a:50"; 65 }; 66 v4 = mkOption { 67 description = "IPv4 address to assign to this client"; 68 example = "192.0.2.1"; 69 type = types.str; 70 }; 71 v6 = mkOption { 72 type = types.listOf types.str; 73 description = "IPv6 addresses or interface-ids to assign to this client"; 74 default = [ ]; 75 example = [ 76 "fe80::42:1eff:fefd:b341" 77 "::1234" 78 ]; 79 }; 80 leasetime = mkOption { 81 type = types.int; 82 default = 86400; 83 }; 84 }; 85 } 86 ); 87 }; 88 domain = mkOption { 89 # this can be given multiple times so probably should be 90 # domains plural and list of string 91 description = "Domain name for DHCP service: causes the DHCP server to return the domain to any hosts which request it, and sets the domain which it is legal for DHCP-configured hosts to claim"; 92 type = types.str; 93 example = "example.com"; 94 }; 95 }; 96 users.dnsmasq = { 97 uid = 51; 98 gid = 51; 99 gecos = "DNS/DHCP service user"; 100 dir = "/run/dnsmasq"; 101 shell = "/bin/false"; 102 }; 103 groups.dnsmasq = { 104 gid = 51; 105 usernames = [ "dnsmasq" ]; 106 }; 107 groups.system.usernames = [ "dnsmasq" ]; 108 }; 109 }