It occured to me yesterday that with the config inside of the module it is kind of difficult to test cgit locally. This moves it back to a separate location (//web/cgit-tvl) and makes the most important things configurable via overrides. Change-Id: I9b0f4c60b75c31441e1718e63b5b55aba3100aae Reviewed-on: https://cl.tvl.fyi/c/depot/+/5893 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			888 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			888 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
# Configuration for running the TVL cgit instance using thttpd.
 | 
						|
{ config, depot, lib, pkgs, ... }:
 | 
						|
 | 
						|
let
 | 
						|
  cfg = config.services.depot.cgit;
 | 
						|
in
 | 
						|
{
 | 
						|
  options.services.depot.cgit = with lib; {
 | 
						|
    enable = mkEnableOption "Run cgit web interface for depot";
 | 
						|
 | 
						|
    port = mkOption {
 | 
						|
      description = "Port on which cgit should listen";
 | 
						|
      type = types.int;
 | 
						|
      default = 2448;
 | 
						|
    };
 | 
						|
 | 
						|
    repo = mkOption {
 | 
						|
      description = "Path to depot's .git folder on the machine";
 | 
						|
      type = types.str;
 | 
						|
      default = "/var/lib/gerrit/git/depot.git/";
 | 
						|
    };
 | 
						|
  };
 | 
						|
 | 
						|
  config = lib.mkIf cfg.enable {
 | 
						|
    systemd.services.cgit = {
 | 
						|
      wantedBy = [ "multi-user.target" ];
 | 
						|
 | 
						|
      serviceConfig = {
 | 
						|
        Restart = "on-failure";
 | 
						|
        User = "git";
 | 
						|
        Group = "git";
 | 
						|
 | 
						|
        ExecStart = depot.web.cgit-tvl.override {
 | 
						|
          inherit (cfg) port repo;
 | 
						|
        };
 | 
						|
      };
 | 
						|
    };
 | 
						|
  };
 | 
						|
}
 |