Fix usage of structured attrs for nix develop

This commit is contained in:
Maximilian Bosch 2021-05-13 01:20:49 +02:00
parent 3944a120ec
commit 447928bdb5
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E
2 changed files with 12 additions and 1 deletions

View file

@ -256,6 +256,11 @@ struct Common : InstallableCommand, MixProfile
// FIXME: properly unquote 'outputs'.
StringMap rewrites;
for (auto & outputName : tokenizeString<std::vector<std::string>>(replaceStrings(outputs->second.quoted, "'", ""))) {
std::regex ptrn(R"re(\[([A-z0-9]+)\]=.*)re");
std::smatch match;
if (std::regex_match(outputName, match, ptrn)) {
outputName = match[1];
}
auto from = buildEnvironment.env.find(outputName);
assert(from != buildEnvironment.env.end());
// FIXME: unquote

View file

@ -8,7 +8,13 @@ if [[ -n $stdenv ]]; then
source $stdenv/setup
fi
for __output in $outputs; do
if [ -e .attrs.sh ]; then
__olist="${!outputs[@]}"
else
__olist=$outputs
fi
for __output in $__olist; do
if [[ -z $__done ]]; then
export > ${!__output}
set >> ${!__output}