diff options
author | William A. Kennington III <william@wkennington.com> | 2014-06-27 02:02:48 -0500 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2014-08-13 15:08:43 -0500 |
commit | b3ddcfabd9d725824f44838e86bd6e74b88c51f0 (patch) | |
tree | 5d515497a7f8e8bd3edd957f2775c3ee8ad3f29f /nixos/modules/services/networking/dhcpd.nix | |
parent | 24368beed84506cf930a355b12e9b17b926dd359 (diff) |
nixos/dhcpd: Convert to systemd from upstart
Diffstat (limited to 'nixos/modules/services/networking/dhcpd.nix')
-rw-r--r-- | nixos/modules/services/networking/dhcpd.nix | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/nixos/modules/services/networking/dhcpd.nix b/nixos/modules/services/networking/dhcpd.nix index 2bc4e5eda43cb..e1c404265f4df 100644 --- a/nixos/modules/services/networking/dhcpd.nix +++ b/nixos/modules/services/networking/dhcpd.nix @@ -115,22 +115,32 @@ in }; }; - jobs.dhcpd = + systemd.services.dhcpd = { description = "DHCP server"; - startOn = "started network-interfaces"; - stopOn = "stopping network-interfaces"; + wantedBy = [ "multi-user.target" ]; - script = + path = [ pkgs.dhcp ]; + + preStart = '' mkdir -m 755 -p ${stateDir} touch ${stateDir}/dhcpd.leases - exec ${pkgs.dhcp}/sbin/dhcpd -f --no-pid -cf ${configFile} \ - -lf ${stateDir}/dhcpd.leases -user dhcpd -group nogroup \ - ${toString cfg.interfaces} + mkdir -m 755 -p /run/dhcpd + chown dhcpd /run/dhcpd ''; + + serviceConfig = + { ExecStart = "@${pkgs.dhcp}/sbin/dhcpd dhcpd" + + " -pf /run/dhcpd/dhcpd.pid -cf ${configFile}" + + " -lf ${stateDir}/dhcpd.leases -user dhcpd -group nogroup" + + " ${toString cfg.interfaces}"; + Restart = "always"; + Type = "forking"; + PIDFile = "/run/dhcpd/dhcpd.pid"; + }; }; }; |