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