1 { config, lib, pkgs, ... }:
4 cfg = config.services.hound;
11 description = lib.mdDoc ''
12 Whether to enable the hound code search daemon.
19 description = lib.mdDoc ''
20 User the hound daemon should execute under.
27 description = lib.mdDoc ''
28 Group the hound daemon should execute under.
32 extraGroups = mkOption {
33 type = types.listOf types.str;
35 example = [ "dialout" ];
36 description = lib.mdDoc ''
37 List of extra groups that the "hound" user should be a part of.
42 default = "/var/lib/hound";
44 description = lib.mdDoc ''
45 The path to use as hound's $HOME. If the default user
46 "hound" is configured then this is the home of the "hound"
53 defaultText = literalExpression "pkgs.hound";
55 description = lib.mdDoc ''
56 Package for running hound.
62 description = lib.mdDoc ''
63 The full configuration of the Hound daemon. Note the dbpath
64 should be an absolute path to a writable location on disk.
66 example = literalExpression ''
69 "max-concurrent-indexers" : 2,
70 "dbpath" : "''${services.hound.home}/data",
73 "url" : "https://www.github.com/NixOS/nixpkgs.git"
83 default = "0.0.0.0:6080";
84 example = "127.0.0.1:6080 or just :6080";
85 description = lib.mdDoc ''
86 Listen on this IP:port / :port
92 config = mkIf cfg.enable {
93 users.groups = optionalAttrs (cfg.group == "hound") {
94 hound.gid = config.ids.gids.hound;
97 users.users = optionalAttrs (cfg.user == "hound") {
99 description = "hound code search";
103 extraGroups = cfg.extraGroups;
104 uid = config.ids.uids.hound;
108 systemd.services.hound = {
109 description = "Hound Code Search";
110 wantedBy = [ "multi-user.target" ];
111 after = [ "network.target" ];
116 WorkingDirectory = cfg.home;
117 ExecStartPre = "${pkgs.git}/bin/git config --global --replace-all http.sslCAinfo /etc/ssl/certs/ca-certificates.crt";
118 ExecStart = "${cfg.package}/bin/houndd" +
119 " -addr ${cfg.listen}" +
120 " -conf ${pkgs.writeText "hound.json" cfg.config}";