mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
nixos/kresd: add .instances option
This commit is contained in:
parent
ae74a0e27c
commit
02bf0557c0
1 changed files with 12 additions and 2 deletions
|
@ -96,6 +96,15 @@ in {
|
|||
For detailed syntax see ListenStream in man systemd.socket.
|
||||
'';
|
||||
};
|
||||
instances = mkOption {
|
||||
type = types.ints.unsigned;
|
||||
default = 1;
|
||||
description = ''
|
||||
The number of instances to start. They will be called kresd@{1,2,...}.service.
|
||||
Knot Resolver uses no threads, so this is the way to scale.
|
||||
You can dynamically start/stop them at will, so this is just system default.
|
||||
'';
|
||||
};
|
||||
# TODO: perhaps options for more common stuff like cache size or forwarding
|
||||
};
|
||||
|
||||
|
@ -112,9 +121,10 @@ in {
|
|||
|
||||
systemd.packages = [ package ]; # the units are patched inside the package a bit
|
||||
|
||||
systemd.targets.kresd = {
|
||||
systemd.targets.kresd = { # configure units started by default
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "kres-cache-gc.service" "kresd@1.service" ];
|
||||
wants = [ "kres-cache-gc.service" ]
|
||||
++ map (i: "kresd@${toString i}.service") (range 1 cfg.instances);
|
||||
};
|
||||
systemd.services."kresd@".serviceConfig = {
|
||||
ExecStart = "${package}/bin/kresd --noninteractive "
|
||||
|
|
Loading…
Reference in a new issue