1 { lib, stdenv, callPackage, closureInfo, xorriso, syslinux, libossp_uuid, squashfsTools
3 , # The file name of the resulting ISO image.
6 , # The files and directories to be placed in the ISO file system.
7 # This is a list of attribute sets {source, target} where `source'
8 # is the file system object (regular file or directory) to be
9 # grafted in the file system at path `target'.
12 , # In addition to `contents', the closure of the store paths listed
13 # in `storeContents' are also placed in the Nix store of the CD.
14 # This is a list of attribute sets {object, symlink} where `object'
15 # is a store path whose closure will be copied, and `symlink' is a
16 # symlink to `object' that will be added to the CD.
19 , # In addition to `contents', the closure of the store paths listed
20 # in `squashfsContents' is compressed as squashfs and the result is
21 # placed in /nix-store.squashfs on the CD.
22 # FIXME: This is a performance optimization to avoid Hydra copying
23 # the squashfs between builders and should be removed when Hydra
24 # is smarter about scheduling.
27 , # Compression settings for squashfs
28 squashfsCompression ? "xz -Xdict-size 100%"
30 , # Whether this should be an El-Torito bootable CD.
33 , # Whether this should be an efi-bootable El-Torito CD.
36 , # Whether this should be an hybrid CD (bootable from USB as well as CD).
39 , # The path (in the ISO file system) of the boot image.
42 , # The path (in the ISO file system) of the efi boot image.
45 , # The path (outside the ISO file system) of the isohybrid-mbr image.
46 isohybridMbrImage ? ""
48 , # Whether to compress the resulting ISO image with zstd.
49 compressImage ? false, zstd
55 assert bootable -> bootImage != "";
56 assert efiBootable -> efiBootImage != "";
57 assert usbBootable -> isohybridMbrImage != "";
60 needSquashfs = squashfsContents != [];
61 makeSquashfsDrv = callPackage ./make-squashfs.nix {
62 storeContents = squashfsContents;
63 comp = squashfsCompression;
68 __structuredAttrs = true;
70 buildCommandPath = ./make-iso9660-image.sh;
71 nativeBuildInputs = [ xorriso syslinux zstd libossp_uuid ]
72 ++ lib.optionals needSquashfs makeSquashfsDrv.nativeBuildInputs;
74 inherit isoName bootable bootImage compressImage volumeID efiBootImage efiBootable isohybridMbrImage usbBootable;
76 sources = map (x: x.source) contents;
77 targets = map (x: x.target) contents;
79 objects = map (x: x.object) storeContents;
80 symlinks = map (x: x.symlink) storeContents;
82 squashfsCommand = lib.optionalString needSquashfs makeSquashfsDrv.buildCommand;
84 # For obtaining the closure of `storeContents'.
85 closureInfo = closureInfo { rootPaths = map (x: x.object) storeContents; };