Skip to content

Commit

Permalink
stdenv: create env-vars file before writing data to it
Browse files Browse the repository at this point in the history
This fixes the regression introduced by c47a1e7
on Darwin. The creation of the file using `install` and process
substitution does not work on Darwin, you get the following complain:
```
install: skipping file '/dev/fd/63', as it was replaced while being copied
```

Fixes #335016

(cherry picked from commit d00775c)
  • Loading branch information
LeSuisse committed Aug 22, 2024
1 parent df7ecf3 commit 0ab819d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkgs/stdenv/generic/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,13 @@ substituteAllInPlace() {
# the environment used for building.
dumpVars() {
if [ "${noDumpEnvVars:-0}" != 1 ]; then
install -m 0600 <(export 2>/dev/null) "$NIX_BUILD_TOP/env-vars" || true
# On darwin, install(1) cannot be called with /dev/stdin or fd from process substitution
# so first we create the file and then write to it
# See https://github.com/NixOS/nixpkgs/issues/335016
{
install -m 0600 /dev/null "$NIX_BUILD_TOP/env-vars" &&
export 2>/dev/null >| "$NIX_BUILD_TOP/env-vars"
} || true
fi
}

Expand Down

0 comments on commit 0ab819d

Please sign in to comment.