| 
									
										
										
										
											2018-10-30 15:44:00 +08:00
										 |  |  | { stdenv, closureInfo, pixz | 
					
						
							| 
									
										
										
										
											2010-02-15 23:27:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | , # The file name of the resulting tarball | 
					
						
							| 
									
										
										
										
											2018-08-20 15:11:29 -04:00
										 |  |  |   fileName ? "nixos-system-${stdenv.hostPlatform.system}" | 
					
						
							| 
									
										
										
										
											2010-02-15 23:27:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | , # The files and directories to be placed in the tarball. | 
					
						
							|  |  |  |   # This is a list of attribute sets {source, target} where `source' | 
					
						
							|  |  |  |   # is the file system object (regular file or directory) to be | 
					
						
							|  |  |  |   # grafted in the file system at path `target'. | 
					
						
							|  |  |  |   contents | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | , # In addition to `contents', the closure of the store paths listed | 
					
						
							|  |  |  |   # in `packages' are also placed in the Nix store of the tarball.  This is | 
					
						
							|  |  |  |   # a list of attribute sets {object, symlink} where `object' if a | 
					
						
							|  |  |  |   # store path whose closure will be copied, and `symlink' is a | 
					
						
							|  |  |  |   # symlink to `object' that will be added to the tarball. | 
					
						
							|  |  |  |   storeContents ? [] | 
					
						
							| 
									
										
										
										
											2014-08-25 02:45:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-11 22:54:46 +01:00
										 |  |  |   # Extra commands to be executed before archiving files | 
					
						
							|  |  |  | , extraCommands ? "" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-25 02:45:33 +02:00
										 |  |  |   # Extra tar arguments | 
					
						
							|  |  |  | , extraArgs ? "" | 
					
						
							| 
									
										
										
										
											2018-03-17 21:26:42 -03:00
										 |  |  |   # Command used for compression | 
					
						
							|  |  |  | , compressCommand ? "pixz" | 
					
						
							|  |  |  |   # Extension for the compressed tarball | 
					
						
							|  |  |  | , compressionExtension ? ".xz" | 
					
						
							|  |  |  |   # extra inputs, like the compressor to use | 
					
						
							|  |  |  | , extraInputs ? [ pixz ] | 
					
						
							| 
									
										
										
										
											2010-02-15 23:27:51 +00:00
										 |  |  | }: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-30 15:44:00 +08:00
										 |  |  | let | 
					
						
							|  |  |  |   symlinks = map (x: x.symlink) storeContents; | 
					
						
							|  |  |  |   objects = map (x: x.object) storeContents; | 
					
						
							|  |  |  | in | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-15 23:27:51 +00:00
										 |  |  | stdenv.mkDerivation { | 
					
						
							|  |  |  |   name = "tarball"; | 
					
						
							|  |  |  |   builder = ./make-system-tarball.sh; | 
					
						
							| 
									
										
										
										
											2020-11-18 13:58:24 +01:00
										 |  |  |   nativeBuildInputs = extraInputs; | 
					
						
							| 
									
										
										
										
											2011-09-14 18:20:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-30 15:44:00 +08:00
										 |  |  |   inherit fileName extraArgs extraCommands compressCommand; | 
					
						
							| 
									
										
										
										
											2010-02-15 23:27:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   # !!! should use XML. | 
					
						
							|  |  |  |   sources = map (x: x.source) contents; | 
					
						
							|  |  |  |   targets = map (x: x.target) contents; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   # !!! should use XML. | 
					
						
							| 
									
										
										
										
											2018-10-30 15:44:00 +08:00
										 |  |  |   inherit symlinks objects; | 
					
						
							| 
									
										
										
										
											2011-09-14 18:20:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-30 15:44:00 +08:00
										 |  |  |   closureInfo = closureInfo { | 
					
						
							|  |  |  |     rootPaths = objects; | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2018-03-17 21:26:42 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  |   extension = compressionExtension; | 
					
						
							| 
									
										
										
										
											2010-02-15 23:27:51 +00:00
										 |  |  | } |