From 56bfc5782d9c61b2c542abbfc08a38533fa18148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Tue, 28 Jan 2025 19:41:12 +0100 Subject: [PATCH] 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. --- nixos/modules/services/search/hound.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/nixos/modules/services/search/hound.nix b/nixos/modules/services/search/hound.nix index 33ade1b963b4..0d76db97759a 100644 --- a/nixos/modules/services/search/hound.nix +++ b/nixos/modules/services/search/hound.nix @@ -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;