Skip to content

Commit 56bfc57

Browse files
committed
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.
1 parent 5ecbe31 commit 56bfc57

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

nixos/modules/services/search/hound.nix

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
let
88
cfg = config.services.hound;
99
settingsFormat = pkgs.formats.json { };
10+
houndConfigFile = pkgs.writeTextFile {
11+
name = "hound-config";
12+
text = builtins.toJSON cfg.settings;
13+
checkPhase = ''
14+
${cfg.package}/bin/houndd -check-conf -conf $out
15+
'';
16+
};
1017
in
1118
{
1219
imports = [
@@ -96,13 +103,7 @@ in
96103
};
97104
};
98105

99-
environment.etc."hound/config.json".source = pkgs.writeTextFile {
100-
name = "hound-config";
101-
text = builtins.toJSON cfg.settings;
102-
checkPhase = ''
103-
${cfg.package}/bin/houndd -check-conf -conf $out
104-
'';
105-
};
106+
environment.etc."hound/config.json".source = houndConfigFile;
106107

107108
services.hound.settings = {
108109
dbpath = "${config.services.hound.home}/data";
@@ -112,6 +113,7 @@ in
112113
description = "Hound Code Search";
113114
wantedBy = [ "multi-user.target" ];
114115
after = [ "network.target" ];
116+
restartTriggers = [ houndConfigFile ];
115117
serviceConfig = {
116118
User = cfg.user;
117119
Group = cfg.group;

0 commit comments

Comments
 (0)