nixos/hound: restart service on config changes

I expect config changes to be observable in the running service after
`sudo nixos-rebuild switch`. hound doesn't seem to support *reload*, so
use restart instead.
This commit is contained in:
Bjørn Forsman 2025-01-28 19:41:12 +01:00
parent 5ecbe31efc
commit 56bfc5782d

View File

@ -7,6 +7,13 @@
let
cfg = config.services.hound;
settingsFormat = pkgs.formats.json { };
houndConfigFile = pkgs.writeTextFile {
name = "hound-config";
text = builtins.toJSON cfg.settings;
checkPhase = ''
${cfg.package}/bin/houndd -check-conf -conf $out
'';
};
in
{
imports = [
@ -96,13 +103,7 @@ in
};
};
environment.etc."hound/config.json".source = pkgs.writeTextFile {
name = "hound-config";
text = builtins.toJSON cfg.settings;
checkPhase = ''
${cfg.package}/bin/houndd -check-conf -conf $out
'';
};
environment.etc."hound/config.json".source = houndConfigFile;
services.hound.settings = {
dbpath = "${config.services.hound.home}/data";
@ -112,6 +113,7 @@ in
description = "Hound Code Search";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
restartTriggers = [ houndConfigFile ];
serviceConfig = {
User = cfg.user;
Group = cfg.group;