pdnsd service: init

Changed files
+98
lib
nixos
doc
manual
release-notes
modules
misc
services
networking
+1
lib/maintainers.nix
···
nathan-gs = "Nathan Bijnens <nathan@nathan.gs>";
nckx = "Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>";
nequissimus = "Tim Steinbach <tim@nequissimus.com>";
nico202 = "Nicolò Balzarotti <anothersms@gmail.com>";
notthemessiah = "Brian Cohen <brian.cohen.88@gmail.com>";
np = "Nicolas Pouillard <np.nix@nicolaspouillard.fr>";
···
nathan-gs = "Nathan Bijnens <nathan@nathan.gs>";
nckx = "Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>";
nequissimus = "Tim Steinbach <tim@nequissimus.com>";
+
nfjinjing = "Jinjing Wang <nfjinjing@gmail.com>";
nico202 = "Nicolò Balzarotti <anothersms@gmail.com>";
notthemessiah = "Brian Cohen <brian.cohen.88@gmail.com>";
np = "Nicolas Pouillard <np.nix@nicolaspouillard.fr>";
+1
nixos/doc/manual/release-notes/rl-unstable.xml
···
<itemizedlist>
<listitem><para><literal>services/monitoring/longview.nix</literal></para></listitem>
<listitem><para><literal>services/web-apps/pump.io.nix</literal></para></listitem>
<listitem><para><literal>services/security/haka.nix</literal></para></listitem>
</itemizedlist>
···
<itemizedlist>
<listitem><para><literal>services/monitoring/longview.nix</literal></para></listitem>
+
<listitem><para><literal>services/networking/pdnsd.nix</literal></para></listitem>
<listitem><para><literal>services/web-apps/pump.io.nix</literal></para></listitem>
<listitem><para><literal>services/security/haka.nix</literal></para></listitem>
</itemizedlist>
+2
nixos/modules/misc/ids.nix
···
matrix-synapse = 224;
rspamd = 225;
rmilter = 226;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
···
matrix-synapse = 224;
rspamd = 225;
rmilter = 226;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal
···
matrix-synapse = 224;
rspamd = 225;
rmilter = 226;
+
pdnsd = 227;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
···
matrix-synapse = 224;
rspamd = 225;
rmilter = 226;
+
pdnsd = 227;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal
+1
nixos/modules/module-list.nix
···
./services/networking/openntpd.nix
./services/networking/openvpn.nix
./services/networking/ostinato.nix
./services/networking/polipo.nix
./services/networking/prayer.nix
./services/networking/privoxy.nix
···
./services/networking/openntpd.nix
./services/networking/openvpn.nix
./services/networking/ostinato.nix
+
./services/networking/pdnsd.nix
./services/networking/polipo.nix
./services/networking/prayer.nix
./services/networking/privoxy.nix
+93
nixos/modules/services/networking/pdnsd.nix
···
···
+
{ config, pkgs, lib, ... }:
+
+
with lib;
+
+
let
+
cfg = config.services.pdnsd;
+
pdnsd = pkgs.pdnsd;
+
pdnsdUser = "pdnsd";
+
pdnsdGroup = "pdnsd";
+
pdnsdConf = pkgs.writeText "pdnsd.conf"
+
''
+
global {
+
run_as=${pdnsdUser};
+
cache_dir="${cfg.cacheDir}";
+
${cfg.globalConfig}
+
}
+
+
server {
+
${cfg.serverConfig}
+
}
+
${cfg.extraConfig}
+
'';
+
in
+
+
{ options =
+
{ services.pdnsd =
+
{ enable = mkEnableOption "pdnsd";
+
+
cacheDir = mkOption {
+
type = types.str;
+
default = "/var/cache/pdnsd";
+
description = "Directory holding the pdnsd cache";
+
};
+
+
globalConfig = mkOption {
+
type = types.lines;
+
default = "";
+
description = ''
+
Global configuration that should be added to the global directory
+
of <literal>pdnsd.conf</literal>.
+
'';
+
};
+
+
serverConfig = mkOption {
+
type = types.lines;
+
default = "";
+
description = ''
+
Server configuration that should be added to the server directory
+
of <literal>pdnsd.conf</literal>.
+
'';
+
};
+
+
extraConfig = mkOption {
+
type = types.lines;
+
default = "";
+
description = ''
+
Extra configuration directives that should be added to
+
<literal>pdnsd.conf</literal>.
+
'';
+
};
+
};
+
};
+
+
config = mkIf cfg.enable {
+
users.extraUsers = singleton {
+
name = pdnsdUser;
+
uid = config.ids.uids.pdnsd;
+
group = pdnsdGroup;
+
description = "pdnsd user";
+
};
+
+
users.extraGroups = singleton {
+
name = pdnsdGroup;
+
gid = config.ids.gids.pdnsd;
+
};
+
+
systemd.services.pdnsd =
+
{ wantedBy = [ "multi-user.target" ];
+
after = [ "network.target" ];
+
preStart =
+
''
+
mkdir -p "${cfg.cacheDir}"
+
touch "${cfg.cacheDir}/pdnsd.cache"
+
chown -R ${pdnsdUser}:${pdnsdGroup} "${cfg.cacheDir}"
+
'';
+
description = "pdnsd";
+
serviceConfig =
+
{
+
ExecStart = "${pdnsd}/bin/pdnsd -c ${pdnsdConf}";
+
};
+
};
+
};
+
}