From acfcf0f40b2f342b3dc28100194579bc05aeb44b Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Wed, 16 Jul 2025 15:28:36 +1000 Subject: [PATCH] make-system-tarball: use `__structuredAttrs` Based on https://github.com/NixOS/nixpkgs/commit/ea81a2465eeef6d470786a4e8a8c5d8e9b5db9f3 --- nixos/lib/make-system-tarball.nix | 6 +++--- nixos/lib/make-system-tarball.sh | 13 +++---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/nixos/lib/make-system-tarball.nix b/nixos/lib/make-system-tarball.nix index 9fb77230cf63..f84fe8f5cbac 100644 --- a/nixos/lib/make-system-tarball.nix +++ b/nixos/lib/make-system-tarball.nix @@ -39,7 +39,9 @@ in stdenv.mkDerivation { name = "tarball"; - builder = ./make-system-tarball.sh; + __structuredAttrs = true; + + buildCommandPath = ./make-system-tarball.sh; nativeBuildInputs = extraInputs; inherit @@ -49,11 +51,9 @@ stdenv.mkDerivation { compressCommand ; - # !!! should use XML. sources = map (x: x.source) contents; targets = map (x: x.target) contents; - # !!! should use XML. inherit symlinks objects; closureInfo = closureInfo { diff --git a/nixos/lib/make-system-tarball.sh b/nixos/lib/make-system-tarball.sh index 8fadc79a13dc..ea24dcf9842d 100644 --- a/nixos/lib/make-system-tarball.sh +++ b/nixos/lib/make-system-tarball.sh @@ -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. stripSlash() { res="$1" @@ -12,10 +5,10 @@ stripSlash() { } # Add the individual files. -for ((i = 0; i < ${#targets_[@]}; i++)); do - stripSlash "${targets_[$i]}" +for ((i = 0; i < ${#targets[@]}; i++)); do + stripSlash "${targets[$i]}" mkdir -p "$(dirname "$res")" - cp -a "${sources_[$i]}" "$res" + cp -a "${sources[$i]}" "$res" done