Cache nix store between builds
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			This commit is contained in:
		| @@ -1,8 +1,45 @@ | ||||
| local Cache(name, settings) = { | ||||
|   name: name, | ||||
|   image: "meltwater/drone-cache", | ||||
|   pull: true, | ||||
|   settings: { | ||||
|     backend: "filesystem", | ||||
|     cache_key: "{{ .Repo.Name }}", | ||||
|     archive_format: "gzip", | ||||
|     mount: [ | ||||
|       "/nix/store" | ||||
|     ] | ||||
|   } + settings, | ||||
|   volumes: [ | ||||
|     { | ||||
|       name: "cache", | ||||
|       path: "/tmp/cache" | ||||
|     } | ||||
|   ] | ||||
| }; | ||||
|  | ||||
| local Pipeline(channel) = { | ||||
|   kind: "pipeline", | ||||
|   type: "docker", | ||||
|   name: channel, | ||||
|   // This is ignored by the drone-cli YAML translator, so unfortunately, it has | ||||
|   // to be copy-pasted into relevant steps. | ||||
|   environment: { | ||||
|     NIXPKGS_ALLOW_UNFREE: 1, | ||||
|     NUR_REPO: "xeals", | ||||
|     CACHIX_CACHE: "xeals", | ||||
|     CACHIX_SIGNING_KEY: { from_secret: "cachix_key" }, | ||||
|   }, | ||||
|   volumes: [ | ||||
|     { | ||||
|       name: "cache", | ||||
|       temp: {} | ||||
|     } | ||||
|   ], | ||||
|   steps: [ | ||||
|     Cache("restore-nix-store", { | ||||
|       restore: true | ||||
|     }), | ||||
|     { | ||||
|       name: "build", | ||||
|       image: "nixos/nix", | ||||
| @@ -32,7 +69,12 @@ local Pipeline(channel) = { | ||||
|         CACHIX_CACHE: "xeals", | ||||
|         CACHIX_SIGNING_KEY: { from_secret: "cachix_key" }, | ||||
|       }, | ||||
|     } | ||||
|     }, | ||||
|     Cache("save-nix-store", { | ||||
|       rebuild: true | ||||
|     }) + { | ||||
|       when: { status: [ "success", "failure" ] } | ||||
|     }, | ||||
|   ] | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user