summary refs log tree commit diff
path: root/modules/services/networking/rdnssd.nix
blob: f797206ad5c768e986ca4ffc1707725b2e96c564 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Module for rdnssd, a daemon that configures DNS servers in
# /etc/resolv/conf from IPv6 RDNSS advertisements.

{ config, pkgs, ... }:

with pkgs.lib;

{

  ###### interface

  options = {

    services.rdnssd.enable = mkOption {
      default = false;
      #default = config.networking.enableIPv6;
      description =
        ''
          Whether to enable the RDNSS daemon
          (<command>rdnssd</command>), which configures DNS servers in
          <filename>/etc/resolv.conf</filename> from RDNSS
          advertisements sent by IPv6 routers.
        '';
    };

  };


  ###### implementation

  config = mkIf config.services.rdnssd.enable {

    jobs.rdnssd =
      { description = "RDNSS daemon";

        # Start before the network interfaces are brought up so that
        # the daemon receives RDNSS advertisements from the kernel.
        startOn = "starting network-interfaces";

        # !!! Should write to /var/run/rdnssd/resolv.conf and run the daemon under another uid.
        exec = "${pkgs.ndisc6}/sbin/rdnssd --resolv-file /etc/resolv.conf -u root";

        daemonType = "fork";
      };

  };

}