make-{iso9660-image,squashfs,system-tarball}: drop references to build closure (#425700)

This commit is contained in:
Naïm Camille Favier
2025-08-21 12:14:26 +02:00
committed by GitHub
4 changed files with 18 additions and 13 deletions

View File

@@ -76,6 +76,10 @@ stdenv.mkDerivation {
name = isoName; name = isoName;
__structuredAttrs = true; __structuredAttrs = true;
# the image will be self-contained so we can drop references
# to the closure that was used to build it
unsafeDiscardReferences.out = true;
buildCommandPath = ./make-iso9660-image.sh; buildCommandPath = ./make-iso9660-image.sh;
nativeBuildInputs = [ nativeBuildInputs = [
xorriso xorriso

View File

@@ -27,6 +27,10 @@ stdenv.mkDerivation {
name = "${fileName}${lib.optionalString (!hydraBuildProduct) ".img"}"; name = "${fileName}${lib.optionalString (!hydraBuildProduct) ".img"}";
__structuredAttrs = true; __structuredAttrs = true;
# the image will be self-contained so we can drop references
# to the closure that was used to build it
unsafeDiscardReferences.out = true;
nativeBuildInputs = [ squashfsTools ]; nativeBuildInputs = [ squashfsTools ];
buildCommand = '' buildCommand = ''

View File

@@ -39,7 +39,13 @@ in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "tarball"; name = "tarball";
builder = ./make-system-tarball.sh; __structuredAttrs = true;
# the tarball will be self-contained so we can drop references
# to the closure that was used to build it
unsafeDiscardReferences.out = true;
buildCommandPath = ./make-system-tarball.sh;
nativeBuildInputs = extraInputs; nativeBuildInputs = extraInputs;
inherit inherit
@@ -49,11 +55,9 @@ stdenv.mkDerivation {
compressCommand compressCommand
; ;
# !!! should use XML.
sources = map (x: x.source) contents; sources = map (x: x.source) contents;
targets = map (x: x.target) contents; targets = map (x: x.target) contents;
# !!! should use XML.
inherit symlinks objects; inherit symlinks objects;
closureInfo = closureInfo { closureInfo = closureInfo {

View File

@@ -1,10 +1,3 @@
sources_=($sources)
targets_=($targets)
objects=($objects)
symlinks=($symlinks)
# Remove the initial slash from a path, since genisofs likes it that way. # Remove the initial slash from a path, since genisofs likes it that way.
stripSlash() { stripSlash() {
res="$1" res="$1"
@@ -12,10 +5,10 @@ stripSlash() {
} }
# Add the individual files. # Add the individual files.
for ((i = 0; i < ${#targets_[@]}; i++)); do for ((i = 0; i < ${#targets[@]}; i++)); do
stripSlash "${targets_[$i]}" stripSlash "${targets[$i]}"
mkdir -p "$(dirname "$res")" mkdir -p "$(dirname "$res")"
cp -a "${sources_[$i]}" "$res" cp -a "${sources[$i]}" "$res"
done done