mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 09:31:01 +00:00
29027fd1e1
Using pkgs.lib on the spine of module evaluation is problematic because the pkgs argument depends on the result of module evaluation. To prevent an infinite recursion, pkgs and some of the modules are evaluated twice, which is inefficient. Using ‘with lib’ prevents this problem.
49 lines
1.1 KiB
Nix
49 lines
1.1 KiB
Nix
# Module for rdnssd, a daemon that configures DNS servers in
|
|
# /etc/resolv/conf from IPv6 RDNSS advertisements.
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
with 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";
|
|
};
|
|
|
|
};
|
|
|
|
}
|