at 23.11-pre 2.1 kB view raw
1{ stdenv, closureInfo, xorriso, syslinux, libossp_uuid 2 3, # The file name of the resulting ISO image. 4 isoName ? "cd.iso" 5 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'. 10 contents 11 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. 17 storeContents ? [] 18 19, # Whether this should be an El-Torito bootable CD. 20 bootable ? false 21 22, # Whether this should be an efi-bootable El-Torito CD. 23 efiBootable ? false 24 25, # Whether this should be an hybrid CD (bootable from USB as well as CD). 26 usbBootable ? false 27 28, # The path (in the ISO file system) of the boot image. 29 bootImage ? "" 30 31, # The path (in the ISO file system) of the efi boot image. 32 efiBootImage ? "" 33 34, # The path (outside the ISO file system) of the isohybrid-mbr image. 35 isohybridMbrImage ? "" 36 37, # Whether to compress the resulting ISO image with zstd. 38 compressImage ? false, zstd 39 40, # The volume ID. 41 volumeID ? "" 42}: 43 44assert bootable -> bootImage != ""; 45assert efiBootable -> efiBootImage != ""; 46assert usbBootable -> isohybridMbrImage != ""; 47 48stdenv.mkDerivation { 49 name = isoName; 50 __structuredAttrs = true; 51 52 buildCommandPath = ./make-iso9660-image.sh; 53 nativeBuildInputs = [ xorriso syslinux zstd libossp_uuid ]; 54 55 inherit isoName bootable bootImage compressImage volumeID efiBootImage efiBootable isohybridMbrImage usbBootable; 56 57 sources = map (x: x.source) contents; 58 targets = map (x: x.target) contents; 59 60 objects = map (x: x.object) storeContents; 61 symlinks = map (x: x.symlink) storeContents; 62 63 # For obtaining the closure of `storeContents'. 64 closureInfo = closureInfo { rootPaths = map (x: x.object) storeContents; }; 65}