fork/home-manager
git clone https://git.julia.blue/fork/home-manager
4fa1ba72
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . services . hound ; 8 9jsonFormat = pkgs . formats . json { }; 10 11configFile = jsonFormat . generate "hound-config.json" { 12max-concurrent-indexers = cfg . maxConcurrentIndexers ; 13dbpath = cfg . databasePath ; 14repos = cfg . repositories ; 15health-check-url = "/healthz" ; 16}; 17 18houndOptions = [ "--addr ${ cfg . listenAddress } " "--conf ${ configFile } " ]; 19 20in { 21meta . maintainers = [ maintainers . adisbladis ]; 22 23options . services . hound = { 24enable = mkEnableOption "hound" ; 25 26maxConcurrentIndexers = mkOption { 27type = types . ints . positive ; 28default = 2 ; 29description = "Limit the amount of concurrent indexers." ; 30}; 31 32databasePath = mkOption { 33type = types . path ; 34default = " ${ config . xdg . dataHome } /hound" ; 35defaultText = "$XDG_DATA_HOME/hound" ; 36description = "The Hound database path." ; 37}; 38 39listenAddress = mkOption { 40type = types . str ; 41default = "localhost:6080" ; 42description = "Listen address of the Hound daemon." ; 43}; 44 45repositories = mkOption { 46type = types . attrsOf jsonFormat . type ; 47default = { }; 48example = literalExpression '' 49{ 50SomeGitRepo = { 51url = "https://www.github.com/YourOrganization/RepoOne.git"; 52ms-between-poll = 10000; 53exclude-dot-files = true; 54}; 55} 56'' ; 57description = "The repository configuration." ; 58}; 59}; 60 61config = mkIf cfg . enable { 62assertions = [ 63( lib . hm . assertions . assertPlatform "services.hound" pkgs 64lib . platforms . linux ) 65]; 66 67home . packages = [ pkgs . hound ]; 68 69systemd . user . services . hound = { 70Unit = { Description = "Hound source code search engine" ; }; 71 72Install = { WantedBy = [ "default.target" ]; }; 73 74Service = { 75Environment = "PATH= ${ makeBinPath [ pkgs . mercurial pkgs . git ]} " ; 76ExecStart = 77" ${ pkgs . hound } /bin/houndd ${ concatStringsSep " " houndOptions } " ; 78}; 79}; 80}; 81}