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 + concatMapStrings (mkListen "doh2") cfg.listenDoH
+ cfg.extraConfig + cfg.extraConfig
); );
package = pkgs.knot-resolver;
in { in {
meta.maintainers = [ maintainers.vcunat /* upstream developer */ ]; meta.maintainers = [ maintainers.vcunat /* upstream developer */ ];
@ -58,6 +56,15 @@ in {
and give commands interactively to kresd@1.service. 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 { extraConfig = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
@ -115,7 +122,7 @@ in {
}; };
users.groups.knot-resolver.gid = null; 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 systemd.targets.kresd = { # configure units started by default
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
@ -123,8 +130,8 @@ in {
++ map (i: "kresd@${toString i}.service") (range 1 cfg.instances); ++ map (i: "kresd@${toString i}.service") (range 1 cfg.instances);
}; };
systemd.services."kresd@".serviceConfig = { systemd.services."kresd@".serviceConfig = {
ExecStart = "${package}/bin/kresd --noninteractive " ExecStart = "${cfg.package}/bin/kresd --noninteractive "
+ "-c ${package}/lib/knot-resolver/distro-preconfig.lua -c ${configFile}"; + "-c ${cfg.package}/lib/knot-resolver/distro-preconfig.lua -c ${configFile}";
# Ensure /run/knot-resolver exists # Ensure /run/knot-resolver exists
RuntimeDirectory = "knot-resolver"; RuntimeDirectory = "knot-resolver";
RuntimeDirectoryMode = "0770"; RuntimeDirectoryMode = "0770";