Skip to content

Commit 494a23f

Browse files
authored
make-{iso9660-image,squashfs,system-tarball}: drop references to build closure (NixOS#425700)
2 parents c5e8f9e + 575a9f0 commit 494a23f

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

nixos/lib/make-iso9660-image.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ stdenv.mkDerivation {
7676
name = isoName;
7777
__structuredAttrs = true;
7878

79+
# the image will be self-contained so we can drop references
80+
# to the closure that was used to build it
81+
unsafeDiscardReferences.out = true;
82+
7983
buildCommandPath = ./make-iso9660-image.sh;
8084
nativeBuildInputs = [
8185
xorriso

nixos/lib/make-squashfs.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ stdenv.mkDerivation {
2727
name = "${fileName}${lib.optionalString (!hydraBuildProduct) ".img"}";
2828
__structuredAttrs = true;
2929

30+
# the image will be self-contained so we can drop references
31+
# to the closure that was used to build it
32+
unsafeDiscardReferences.out = true;
33+
3034
nativeBuildInputs = [ squashfsTools ];
3135

3236
buildCommand = ''

nixos/lib/make-system-tarball.nix

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ in
3939

4040
stdenv.mkDerivation {
4141
name = "tarball";
42-
builder = ./make-system-tarball.sh;
42+
__structuredAttrs = true;
43+
44+
# the tarball will be self-contained so we can drop references
45+
# to the closure that was used to build it
46+
unsafeDiscardReferences.out = true;
47+
48+
buildCommandPath = ./make-system-tarball.sh;
4349
nativeBuildInputs = extraInputs;
4450

4551
inherit
@@ -49,11 +55,9 @@ stdenv.mkDerivation {
4955
compressCommand
5056
;
5157

52-
# !!! should use XML.
5358
sources = map (x: x.source) contents;
5459
targets = map (x: x.target) contents;
5560

56-
# !!! should use XML.
5761
inherit symlinks objects;
5862

5963
closureInfo = closureInfo {

nixos/lib/make-system-tarball.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
sources_=($sources)
2-
targets_=($targets)
3-
4-
objects=($objects)
5-
symlinks=($symlinks)
6-
7-
81
# Remove the initial slash from a path, since genisofs likes it that way.
92
stripSlash() {
103
res="$1"
114
if test "${res:0:1}" = /; then res=${res:1}; fi
125
}
136

147
# Add the individual files.
15-
for ((i = 0; i < ${#targets_[@]}; i++)); do
16-
stripSlash "${targets_[$i]}"
8+
for ((i = 0; i < ${#targets[@]}; i++)); do
9+
stripSlash "${targets[$i]}"
1710
mkdir -p "$(dirname "$res")"
18-
cp -a "${sources_[$i]}" "$res"
11+
cp -a "${sources[$i]}" "$res"
1912
done
2013

2114

0 commit comments

Comments
 (0)