Merge #120493: nixos/kresd: allow package to be configured

This commit is contained in:
Vladimír Čunát 2021-04-29 10:41:12 +02:00
commit 5b0871bd97
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA

View file

@ -29,8 +29,6 @@ let
+ concatMapStrings (mkListen "doh2") cfg.listenDoH
+ cfg.extraConfig
);
package = pkgs.knot-resolver;
in {
meta.maintainers = [ maintainers.vcunat /* upstream developer */ ];
@ -58,6 +56,15 @@ in {
and give commands interactively to kresd@1.service.
'';
};
package = mkOption {
type = types.package;
description = "
knot-resolver package to use.
";
default = pkgs.knot-resolver;
defaultText = "pkgs.knot-resolver";
example = literalExample "pkgs.knot-resolver.override { extraFeatures = true; }";
};
extraConfig = mkOption {
type = types.lines;
default = "";
@ -115,7 +122,7 @@ in {
};
users.groups.knot-resolver.gid = null;
systemd.packages = [ package ]; # the units are patched inside the package a bit
systemd.packages = [ cfg.package ]; # the units are patched inside the package a bit
systemd.targets.kresd = { # configure units started by default
wantedBy = [ "multi-user.target" ];
@ -123,8 +130,8 @@ in {
++ map (i: "kresd@${toString i}.service") (range 1 cfg.instances);
};
systemd.services."kresd@".serviceConfig = {
ExecStart = "${package}/bin/kresd --noninteractive "
+ "-c ${package}/lib/knot-resolver/distro-preconfig.lua -c ${configFile}";
ExecStart = "${cfg.package}/bin/kresd --noninteractive "
+ "-c ${cfg.package}/lib/knot-resolver/distro-preconfig.lua -c ${configFile}";
# Ensure /run/knot-resolver exists
RuntimeDirectory = "knot-resolver";
RuntimeDirectoryMode = "0770";