wip: add structured attrs support (broken gcc)

This commit is contained in:
Jake Hamilton 2025-09-14 04:13:25 -07:00
parent f4f1f0aea7
commit 9e7e3da08e
Signed by: jakehamilton
GPG key ID: 9762169A1B35EA68

View file

@ -52,7 +52,14 @@ in
sorted = lib.dag.sort.topological phases;
script = lib.strings.concatMapSep "\n" (entry: entry.value) sorted.result;
script = lib.strings.concatMapSep "\n"
(entry:
''
# Phase: ${entry.name}
${entry.value}
''
)
sorted.result;
executable =
if system == "i686-linux" then
@ -74,7 +81,7 @@ in
inherit (package) name;
inherit script system;
passAsFile = [ "script" ];
__structuredAttrs = true;
SHELL = executable;
@ -112,6 +119,8 @@ in
args = [
"-e"
(builtins.toFile "bash-builder.sh" ''
source $NIX_ATTRS_SH_FILE
export CONFIG_SHELL=$SHELL
# Normalize the NIX_BUILD_CORES variable. The value might be 0, which
@ -124,7 +133,16 @@ in
fi
export NIX_BUILD_CORES
bash -eux $scriptPath
# Outputs is an associative array of output names to paths
for name in "''${!outputs[@]}"; do
eval "export ''${name//-/_}=\"''${outputs[$name]}\""
done
# We have the raw script text in an environment variable named "script". Now
# we need to run those commands.
echo "$script" > .build.sh
bash .build.sh
'')
];
}