Skip to content

Commit a9ac4de

Browse files
authored
nixos/hound: restart service on changes (#377611)
2 parents 0921535 + 5555b70 commit a9ac4de

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
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.json";
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;

nixos/tests/hound.nix

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@ import ./make-test-python.nix (
1111
{
1212
services.hound = {
1313
enable = true;
14-
config = ''
15-
{
16-
"max-concurrent-indexers": 1,
17-
"dbpath": "/var/lib/hound/data",
18-
"repos": {
19-
"nix": {
20-
"url": "file:///var/lib/hound/my-git"
21-
}
22-
}
23-
}
24-
'';
14+
settings = {
15+
"max-concurrent-indexers" = 1;
16+
"dbpath" = "/var/lib/hound/data";
17+
"repos" = {
18+
"nix" = {
19+
"url" = "file:///var/lib/hound/my-git";
20+
};
21+
};
22+
};
2523
};
2624

2725
systemd.services.houndseed = {

0 commit comments

Comments
 (0)