From 56226c4674d43c086ab8cf4e2be8656afcac4918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Fri, 3 Feb 2023 15:25:12 +0100 Subject: [PATCH 1/2] make-squashfs: use `__structuredAttrs` Makes it easier to enable discarding of references, a feature of Nix 2.14 which requires structured attrs. --- nixos/lib/make-squashfs.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/lib/make-squashfs.nix b/nixos/lib/make-squashfs.nix index 170d315fb75..d1260a48f22 100644 --- a/nixos/lib/make-squashfs.nix +++ b/nixos/lib/make-squashfs.nix @@ -10,6 +10,7 @@ stdenv.mkDerivation { name = "squashfs.img"; + __structuredAttrs = true; nativeBuildInputs = [ squashfsTools ]; From ea81a2465eeef6d470786a4e8a8c5d8e9b5db9f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Fri, 3 Feb 2023 15:28:04 +0100 Subject: [PATCH 2/2] make-iso9660-image: use `__structuredAttrs` Makes it easier to enable discarding of references, a feature of Nix 2.14 which requires structured attrs. --- nixos/lib/make-iso9660-image.nix | 6 +++--- nixos/lib/make-iso9660-image.sh | 25 ++++++++----------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/nixos/lib/make-iso9660-image.nix b/nixos/lib/make-iso9660-image.nix index 549530965f6..2f7dcf519a1 100644 --- a/nixos/lib/make-iso9660-image.nix +++ b/nixos/lib/make-iso9660-image.nix @@ -47,16 +47,16 @@ assert usbBootable -> isohybridMbrImage != ""; stdenv.mkDerivation { name = isoName; - builder = ./make-iso9660-image.sh; + __structuredAttrs = true; + + buildCommandPath = ./make-iso9660-image.sh; nativeBuildInputs = [ xorriso syslinux zstd libossp_uuid ]; inherit isoName bootable bootImage compressImage volumeID efiBootImage efiBootable isohybridMbrImage usbBootable; - # !!! should use XML. sources = map (x: x.source) contents; targets = map (x: x.target) contents; - # !!! should use XML. objects = map (x: x.object) storeContents; symlinks = map (x: x.symlink) storeContents; diff --git a/nixos/lib/make-iso9660-image.sh b/nixos/lib/make-iso9660-image.sh index 9273b8d3db8..34febe9cfe0 100644 --- a/nixos/lib/make-iso9660-image.sh +++ b/nixos/lib/make-iso9660-image.sh @@ -1,12 +1,3 @@ -source $stdenv/setup - -sources_=($sources) -targets_=($targets) - -objects=($objects) -symlinks=($symlinks) - - # Remove the initial slash from a path, since genisofs likes it that way. stripSlash() { res="$1" @@ -35,13 +26,13 @@ if test -n "$bootable"; then # The -boot-info-table option modifies the $bootImage file, so # find it in `contents' and make a copy of it (since the original # is read-only in the Nix store...). - for ((i = 0; i < ${#targets_[@]}; i++)); do - stripSlash "${targets_[$i]}" + for ((i = 0; i < ${#targets[@]}; i++)); do + stripSlash "${targets[$i]}" if test "$res" = "$bootImage"; then - echo "copying the boot image ${sources_[$i]}" - cp "${sources_[$i]}" boot.img + echo "copying the boot image ${sources[$i]}" + cp "${sources[$i]}" boot.img chmod u+w boot.img - sources_[$i]=boot.img + sources[$i]=boot.img fi done @@ -66,9 +57,9 @@ touch pathlist # Add the individual files. -for ((i = 0; i < ${#targets_[@]}; i++)); do - stripSlash "${targets_[$i]}" - addPath "$res" "${sources_[$i]}" +for ((i = 0; i < ${#targets[@]}; i++)); do + stripSlash "${targets[$i]}" + addPath "$res" "${sources[$i]}" done