lib.types.string concatenates conflicting definitions on module merge which is counter intuitive and hard to debug behavior. Change-Id: I8ccdca0e8895fb5cc4600c367f8d52a9ab80ff75 Reviewed-on: https://cl.tvl.fyi/c/depot/+/13177 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: aspen <root@gws.fyi>
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| # Configuration for builderball, the Nix cache proxy for substituting between
 | |
| # builders.
 | |
| #
 | |
| # This is in experimental state, not yet supporting any dynamic private builders.
 | |
| { depot, config, lib, ... }:
 | |
| 
 | |
| let
 | |
|   cfg = config.services.depot.builderball;
 | |
|   description = "Nix cache proxy for distribution between builders";
 | |
|   hostname = config.networing.hostName;
 | |
| in
 | |
| {
 | |
|   options.services.depot.builderball = {
 | |
|     enable = lib.mkEnableOption description;
 | |
| 
 | |
|     caches = lib.mkOption {
 | |
|       type = with lib.types; listOf str;
 | |
|       description = "Public addresses of caches to use";
 | |
| 
 | |
|       default = [
 | |
|         "nevsky.cache.tvl.fyi"
 | |
|       ];
 | |
|     };
 | |
| 
 | |
|     port = lib.mkOption {
 | |
|       type = lib.types.int;
 | |
|       description = "port on which to listen locally";
 | |
|       default = 26862; # bounc
 | |
|     };
 | |
|   };
 | |
| 
 | |
|   config = lib.mkIf cfg.enable {
 | |
|     systemd.services.builderball =
 | |
|       let
 | |
|         caches = lib.concatStringsSep " " (map (c: "-cache https://${c}") cfg.caches);
 | |
|       in
 | |
|       {
 | |
|         inherit description;
 | |
|         wantedBy = [ "multi-user.target" ];
 | |
|         wants = [ "network-online.target" ];
 | |
|         after = [ "network-online.target" ];
 | |
| 
 | |
|         serviceConfig = {
 | |
|           ExecStart = "${depot.ops.builderball}/bin/builderball ${caches} -port ${toString cfg.port} -debug";
 | |
|           DynamicUser = true;
 | |
|           Restart = "always";
 | |
|         };
 | |
|       };
 | |
|   };
 | |
| }
 |