Commit Graph

1203 Commits

Author SHA1 Message Date
github-actions[bot]
7fc19ff961
Merge staging-next into staging 2024-09-20 18:05:01 +00:00
Johannes Kirschbauer
e2dd770370
Doc: clarify mkDerivation argument handling (#343247) 2024-09-20 16:01:49 +02:00
github-actions[bot]
33e2cbc61f
Merge staging-next into staging 2024-09-20 12:05:56 +00:00
Johannes Kirschbauer
f14a171413
Doc: init stdenv.mkDerivation doc-comment 2024-09-20 12:13:43 +02:00
github-actions[bot]
1c3463dc7a
Merge staging-next into staging 2024-09-16 12:06:19 +00:00
Yueh-Shun Li
30809ccecd stdenv.mkDerivation: simplify overrideAttrs with extends and toOverlay 2024-09-14 20:56:49 +08:00
Philip Taron
05e5a56f04
auto-patchelf: refactor structuredAttrs support (#340858) 2024-09-12 15:13:20 -07:00
Wolfgang Walther
bc0395ee6f
auto-patchelf: refactor structuredAttrs support
stdenv now provides better tooling to support structuredAttrs without
depending on $__structuredAttrs itself.
2024-09-11 19:29:39 +02:00
Philip Taron
f4cd623ed3
stdenv: bump required Bash version from 4 to 5 (#340765) 2024-09-11 07:32:57 -07:00
Ivan Trubach
799d0c8a7d stdenv: bump required Bash version from 4 to 5
Currently stdenv requires Bash 4.x that was released in 2009. This
change bumps the required version to Bash 5.x (2019, 5 years ago).

See https://mywiki.wooledge.org/BashFAQ/061 for more details.

Using a relatively modern Bash version allows us to rely on newer
features (e.g. ${var@a}) and remove workarounds for older quirks (e.g.
https://stackoverflow.com/a/7577209, “old bash empty array problem”).
Note that many setup hooks are using features added after 4.0 version,
e.g. makeWrapper uses ${var@Q} from 4.4, but some even require >5.0,
e.g. cargoBuildHook uses ${var@U} from 5.1.
2024-09-09 15:22:11 +03:00
Wolfgang Walther
1efcffa700
stdenv: support default values in concatTo
The previously used pattern was introduced in #318614, but technically
leaked the default flags into the global scope. While this would
probably not make much of a practical difference, making concatTo
support default values is a much cleaner approach.
2024-08-24 12:23:35 +02:00
Thomas Gerbet
d00775c1d9 stdenv: create env-vars file before writing data to it
This fixes the regression introduced by c47a1e701d
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
2024-08-20 19:02:41 +02:00
Someone Serge
ebf6790c39 stdenv: concatTo: fall back to old behaviour for "*Array" variables
Fixes e.g. the `sudo` build failure
2024-08-16 12:51:51 +00:00
Someone
ccaaa9ca53
Merge pull request #318614 from wolfgangwalther/structured-attrs-setup-hooks
treewide: support structuredAttrs in setup hooks
2024-08-13 19:29:36 +00:00
Someone Serge
64eaa63181 stdenv: concatStringsSep: quote ${sep} 2024-08-10 23:38:10 +00:00
github-actions[bot]
addc823ceb
Merge master into staging-next 2024-08-07 12:01:21 +00:00
K900
a74e503640 make-derivation.nix: *unfancies your quotes* 2024-08-07 09:28:39 +03:00
K900
7cd4d5d7a3 make-derivation.nix: better error reporting for conflicting env attributes 2024-08-06 18:57:51 +03:00
Philip Taron
d8fbb16219
stdenv: change the logging in _allFlags to talkative 2024-08-05 18:35:57 -07:00
Philip Taron
e844424e4f
stdenv: replace other $NIX_DEBUG log statements 2024-08-05 18:35:57 -07:00
Philip Taron
465dbd2ddf
stdenv: log hooks at nixTalkativeLog level
Nix filters out messages with level ≥ 4 by default as of this commit.
2024-08-05 18:35:57 -07:00
Philip Taron
624463391d
stdenv: introduce specific logging functions 2024-08-05 18:35:57 -07:00
Philip Taron
bbb9f2f1c9
stdenv: set the phase in showPhaseHeader 2024-08-05 18:35:57 -07:00
éclairevoyant
1188923cde
Revert "pkgs/top-level/config.nix: nixfmt, declare options" 2024-08-05 16:44:45 +00:00
éclairevoyant
d65c92e966
pkgs/top-level/config.nix: pass nixf-tidy 2024-08-05 01:10:07 -04:00
éclairevoyant
1d47396274
pkgs/top-level/config.nix: add options.inHydra 2024-08-05 01:10:06 -04:00
éclairevoyant
139f90426b
pkgs/top-level/config.nix: add options.{permittedInsecurePackages,allowInsecurePredicate} 2024-08-05 01:10:06 -04:00
éclairevoyant
333370df4f
pkgs/top-level/config.nix: add options.allowNonSourcePredicate 2024-08-04 14:54:34 -04:00
éclairevoyant
598f2257d7
pkgs/top-level/config.nix: add options.allowUnfreePredicate 2024-08-04 14:54:33 -04:00
Wolfgang Walther
471cbdd062
stdenv: add concatStringsSep helper
This can be used to separate lists for example with commas, when
creating argument strings. This works with both structuredAttrs disabled
and enabled.
2024-08-02 22:11:41 +02:00
Wolfgang Walther
8cb51ec38e
stdenv: refactor default flags without __structuredAttrs use
Instead of checking for __structuredAttrs everywhere, it's easier to
just set the default value via parameter expansion and then hand the
array construction off to "concatTo".

Once more setup-hooks will be made structuredAttrs-aware, this pattern
will reduce the use of this implementation detail even more.
2024-08-02 22:11:38 +02:00
Wolfgang Walther
6bdfef9d2d
stdenv: generalize _accumFlagsArray to concatTo
Passing "flagsArray" as the first argument allows using this function
in a few more places.
2024-08-02 22:11:38 +02:00
Wolfgang Walther
bfd97a691f
stdenv: make _accumFlagsArray independent of structuredAttrs
structuredAttrs was used here to make an assumption about the type of
the named variables passed as arguments.  This can be done better by
looking at the actual types of those variables.

This gives a bit more backwards compatibility as well: Once you turn to
structuredAttrs, you should still be able to pass a bare string instead
of a list and have it behave as a whitespace-separated string like
before.
2024-08-02 21:54:25 +02:00
Thomas Gerbet
c47a1e701d stdenv: make sure the env-vars file created is not world readable
Under some circumstances this file might contain private information
that should not be accessible to everybody.
2024-08-01 19:26:05 +02:00
Pol Dellaiera
5efe6c1019
Merge pull request #330830 from tie/nix-develop-unbound-variable
stdenv: fix unbound NIX_LOG_FD in `nix develop`
2024-07-30 23:00:01 +02:00
Wolfgang Walther
cdb2f2971c
stdenv: refactor appendToVar and prependToVar
No need to call declare -p twice. The case statement is easier to read
than the multi-if.
2024-07-30 21:38:14 +02:00
éclairevoyant
1899a02870
pkgs/top-level/config.nix: add options.allowNonSource 2024-07-29 14:00:40 -04:00
Ivan Trubach
bd872b4a77 stdenv: fix unbound NIX_LOG_FD in nix develop
When running `nix develop` for a package, Nix records the stdenv
environment with NIX_LOG_FD set. That is, when the actual development
shell runs, it uses the functions that attempt to log to NIX_LOG_FD, but
this variable is not actually set.

As a workaround, check whether NIX_LOG_FD is set at runtime.

Example (before this change):
```console
$ nix develop --file . bash
$ echo "${NIX_LOG_FD-unset}"
unset
$ runPhase unpackPhase
bash: "$NIX_LOG_FD": Bad file descriptor
Running phase: unpackPhase
unpacking source archive /nix/store/v28dv6l0qk3j382kp40bksa1v6h7dx9p-bash-5.2.tar.gz
bash: "$NIX_LOG_FD": Bad file descriptor
source root is bash-5.2
bash: "$NIX_LOG_FD": Bad file descriptor
setting SOURCE_DATE_EPOCH to timestamp 1663942708 of file bash-5.2/y.tab.h
```

After this change:
```console
$ nix develop --file . bash
$ runPhase unpackPhase
Running phase: unpackPhase
unpacking source archive /nix/store/v28dv6l0qk3j382kp40bksa1v6h7dx9p-bash-5.2.tar.gz
source root is bash-5.2
setting SOURCE_DATE_EPOCH to timestamp 1663942708 of file bash-5.2/y.tab.h
```
2024-07-29 13:08:17 +03:00
Robert Scott
48bde3a189 cc-wrapper: add support for pacret hardening flag on aarch64 2024-07-28 19:27:14 +01:00
Emily
8a837af302
Merge pull request #326819 from risicle/ris-shadowstack
cc-wrapper: add support for `shadowstack` hardening flag
2024-07-28 19:07:52 +01:00
toonn
c3c5870e96
Merge pull request #307880 from reckenrode/ld64
cctools: 973.0.1 -> 1010.6
2024-07-17 08:22:14 +02:00
Robert Scott
b207b6ef74 cc-wrapper: add support for shadowstack hardening flag 2024-07-14 21:25:47 +01:00
Yueh-Shun Li
c65cf1b9c5
pkgs/stdenv/generic/setup.sh: fix unbound variables and pass ShellCheck checks (#298831)
* pkgs/stdenv/generic/setup.sh: supress ShellCheck error about Bash array indexing syntax

* pkgs/stdenv/generic/setup.sh: loop by per-line read

* pkgs/stdenv/generic/setup.sh: fix variable quoting

* pkgs/stdenv/generic/setup.sh: separate declaration and assignment
2024-07-14 19:17:55 +03:00
Randy Eckenrode
10c87ee2c7
stdenv: set NIX_DONT_SET_RPATH_FOR_TARGET on Darwin 2024-07-13 17:54:35 -04:00
Martin Weinelt
176a56c40f
Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
- pkgs/applications/misc/blender/default.nix
- pkgs/development/web/nodejs/nodejs.nix
2024-07-11 01:06:28 +02:00
John Ericson
000b58721f Merge remote-tracking branch 'upstream/master' into openbsd-static 2024-07-09 18:18:47 -04:00
John Ericson
676df1cf2d openbsd: Add static linking support
I've had better luck creating statically-linked binaries that work than
dynamically-linked ones, so this is needed quite practically.
2024-07-09 18:17:06 -04:00
Ryan Hendrickson
40428630bc
Merge pull request #317106 from trofi/dashed-source
stdenv: handle $sourceRoot that starts with dash
2024-07-02 23:48:25 -04:00
K900
e2665b3080 stdenv: fix typo 2024-06-24 10:17:10 +03:00
Martin Weinelt
2096642430
Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
- pkgs/os-specific/windows/mingw-w64/default.nix
2024-06-23 19:09:00 +02:00