1 { config, lib, pkgs, ... }:
3 cfg = config.services.hound;
4 settingsFormat = pkgs.formats.json { };
7 (lib.mkRemovedOptionModule [ "services" "hound" "extraGroups" ] "Use users.users.hound.extraGroups instead")
8 (lib.mkChangedOptionModule [ "services" "hound" "config" ] [ "services" "hound" "settings" ] (config: builtins.fromJSON config.services.hound.config))
11 meta.maintainers = with lib.maintainers; [ SuperSandro2000 ];
15 enable = lib.mkEnableOption "hound";
17 package = lib.mkPackageOption pkgs "hound" { };
23 User the hound daemon should execute under.
27 group = lib.mkOption {
31 Group the hound daemon should execute under.
36 default = "/var/lib/hound";
37 type = lib.types.path;
39 The path to use as hound's $HOME.
40 If the default user "hound" is configured then this is the home of the "hound" user.
44 settings = lib.mkOption {
45 type = settingsFormat.type;
46 example = lib.literalExpression ''
48 max-concurrent-indexers = 2;
49 repos.nixpkgs.url = "https://www.github.com/NixOS/nixpkgs.git";
53 The full configuration of the Hound daemon.
54 See the upstream documentation <https://github.com/hound-search/hound/blob/main/docs/config-options.md> for details.
57 The `dbpath` should be an absolute path to a writable directory.
58 :::.com/hound-search/hound/blob/main/docs/config-options.md>.
62 listen = lib.mkOption {
64 default = "0.0.0.0:6080";
67 Listen on this [IP]:port
73 config = lib.mkIf cfg.enable {
74 users.groups = lib.mkIf (cfg.group == "hound") {
78 users.users = lib.mkIf (cfg.user == "hound") {
80 description = "Hound code search";
83 inherit (cfg) home group;
87 environment.etc."hound/config.json".source = pkgs.writeTextFile {
88 name = "hound-config";
89 text = builtins.toJSON cfg.settings;
91 ${cfg.package}/bin/houndd -check-conf -conf $out
95 services.hound.settings = {
96 dbpath = "${config.services.hound.home}/data";
99 systemd.services.hound = {
100 description = "Hound Code Search";
101 wantedBy = [ "multi-user.target" ];
102 after = [ "network.target" ];
106 WorkingDirectory = cfg.home;
107 ExecStartPre = "${pkgs.git}/bin/git config --global --replace-all http.sslCAinfo /etc/ssl/certs/ca-certificates.crt";
108 ExecStart = "${cfg.package}/bin/houndd -addr ${cfg.listen} -conf /etc/hound/config.json";