mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
parent
c11f6c9dc7
commit
a193ea3700
1 changed files with 10 additions and 6 deletions
|
@ -5,8 +5,10 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.dnsmasq;
|
cfg = config.services.dnsmasq;
|
||||||
dnsmasq = pkgs.dnsmasq;
|
dnsmasq = pkgs.dnsmasq;
|
||||||
|
stateDir = "/var/lib/dnsmasq";
|
||||||
|
|
||||||
dnsmasqConf = pkgs.writeText "dnsmasq.conf" ''
|
dnsmasqConf = pkgs.writeText "dnsmasq.conf" ''
|
||||||
|
dhcp-leasefile=${stateDir}/dnsmasq.leases
|
||||||
${optionalString cfg.resolveLocalQueries ''
|
${optionalString cfg.resolveLocalQueries ''
|
||||||
conf-file=/etc/dnsmasq-conf.conf
|
conf-file=/etc/dnsmasq-conf.conf
|
||||||
resolv-file=/etc/dnsmasq-resolv.conf
|
resolv-file=/etc/dnsmasq-resolv.conf
|
||||||
|
@ -76,12 +78,11 @@ in
|
||||||
|
|
||||||
services.dbus.packages = [ dnsmasq ];
|
services.dbus.packages = [ dnsmasq ];
|
||||||
|
|
||||||
users.extraUsers = singleton
|
users.extraUsers = singleton {
|
||||||
{ name = "dnsmasq";
|
name = "dnsmasq";
|
||||||
uid = config.ids.uids.dnsmasq;
|
uid = config.ids.uids.dnsmasq;
|
||||||
description = "Dnsmasq daemon user";
|
description = "Dnsmasq daemon user";
|
||||||
home = "/var/empty";
|
};
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.dnsmasq = {
|
systemd.services.dnsmasq = {
|
||||||
description = "Dnsmasq Daemon";
|
description = "Dnsmasq Daemon";
|
||||||
|
@ -89,6 +90,9 @@ in
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = [ dnsmasq ];
|
path = [ dnsmasq ];
|
||||||
preStart = ''
|
preStart = ''
|
||||||
|
mkdir -m 755 -p ${stateDir}
|
||||||
|
touch ${stateDir}/dnsmasq.leases
|
||||||
|
chown -R dnsmasq ${stateDir}
|
||||||
touch /etc/dnsmasq-{conf,resolv}.conf
|
touch /etc/dnsmasq-{conf,resolv}.conf
|
||||||
dnsmasq --test
|
dnsmasq --test
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue