Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hound service #777

Closed
wants to merge 1 commit into from

Conversation

@adisbladis
Copy link
Contributor

commented Aug 2, 2019

Hound is a pretty cool code search tool :)

I use it with the following config to automatically index all my local checkouts:

let 
  findGitRecursive = root: let
    files = builtins.readDir root;
    dirs = lib.filterAttrs (k: v: v == "directory") files;
    repoSet = lib.mapAttrs (k: v: builtins.pathExists (root + "/${k}/.git")) dirs;
    repos = builtins.map (v: builtins.toString (root + "/${v}")) (lib.attrNames (lib.filterAttrs (k: v: v) repoSet));
    notRepos = lib.attrNames (lib.filterAttrs (k: v: !v) repoSet);
    nestedRepos = builtins.foldl' (a: v: a ++ findGitRecursive (root + "/${v}")) [] notRepos;
  in repos ++ nestedRepos;

in {

  services.hound = {
    enable = true;
    repos = let
      repos = findGitRecursive /home/adisbladis/sauce;
    in lib.listToAttrs (builtins.map (v: {
      name = builtins.baseNameOf v;
      value = { url = "file://" + v; };
    }) repos);
  };

}

@adisbladis adisbladis force-pushed the adisbladis:hound-service branch 2 times, most recently from db8c3bf to e839edd Aug 2, 2019

modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/modules.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
modules/services/hound.nix Outdated Show resolved Hide resolved
@rycee

This comment has been minimized.

Copy link
Owner

commented Aug 8, 2019

Thanks for the contribution! Looks like an interesting tool!

I've added some comments. Also please change the commit message to hound: add module to match the contribution guidelines.

@adisbladis adisbladis force-pushed the adisbladis:hound-service branch from 0276aa8 to d745a10 Aug 8, 2019

@adisbladis

This comment has been minimized.

Copy link
Contributor Author

commented Aug 8, 2019

@rycee Thanks for your feedback. I believe everything should be addressed now.

@rycee

This comment has been minimized.

Copy link
Owner

commented Aug 8, 2019

Thanks! Rebased to master in a9ecef1.

@rycee rycee closed this Aug 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.