Skip to content

Commit

Permalink
nixos/hound: restart service on changes (#377611)
Browse files Browse the repository at this point in the history
  • Loading branch information
fpletz authored Jan 29, 2025
2 parents 0921535 + 5555b70 commit a9ac4de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 9 additions & 7 deletions nixos/modules/services/search/hound.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
let
cfg = config.services.hound;
settingsFormat = pkgs.formats.json { };
houndConfigFile = pkgs.writeTextFile {
name = "hound-config.json";
text = builtins.toJSON cfg.settings;
checkPhase = ''
${cfg.package}/bin/houndd -check-conf -conf $out
'';
};
in
{
imports = [
Expand Down Expand Up @@ -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";
Expand All @@ -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;
Expand Down
20 changes: 9 additions & 11 deletions nixos/tests/hound.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ import ./make-test-python.nix (
{
services.hound = {
enable = true;
config = ''
{
"max-concurrent-indexers": 1,
"dbpath": "/var/lib/hound/data",
"repos": {
"nix": {
"url": "file:///var/lib/hound/my-git"
}
}
}
'';
settings = {
"max-concurrent-indexers" = 1;
"dbpath" = "/var/lib/hound/data";
"repos" = {
"nix" = {
"url" = "file:///var/lib/hound/my-git";
};
};
};
};

systemd.services.houndseed = {
Expand Down

0 comments on commit a9ac4de

Please sign in to comment.