nixpkgs/pkgs/stdenv
Maximilian Bosch 8bc5104a6e
treewide: refactor .attrs.sh detection
When specifying the `builder` attribute in `stdenv.mkDerivation`, this
will be effectively transformed into

    builtins.derivation {
      builder = stdenv.shell;
      args = [ "-e" builder ];
    }

This also means that `default-builder.sh` is never sourced and as a
result it's not guaranteed that `$NIX_ATTRS_SH_FILE` is set to a correct
location[1].

Also, we need to source `.attrs.sh` to source `$stdenv`. So, the
following is done now:

* If `$NIX_ATTRS_SH_FILE` points to a correct location, then use it.
  Directly using `.attrs.sh` is problematic for `nix-shell(1)` usage
  (see previous commit for more context), so prefer the environment
  variable if possible.

* Otherwise, if `.attrs.sh` exists, then use it. See [1] for when this
  can happen.

* If neither applies, it can be assumed that `__structuredAttrs` is
  turned off and thus nothing needs to be done.

[1] It's possible that it doesn't exist at all - in case of Nix 2.3 or
    it can point to a wrong location on older Nix versions with a bug in
    `__structuredAttrs`.
2023-10-04 18:36:57 +02:00
..
cross pkgs: fix typos 2023-05-19 22:31:04 -04:00
custom
cygwin
darwin freshBootstrapTools.bootstrapTools: fix eval on darwin 2023-09-07 04:24:05 +03:00
freebsd config.contentAddressedByDefault: init option 2022-04-27 23:21:32 +03:00
generic treewide: refactor .attrs.sh detection 2023-10-04 18:36:57 +02:00
linux Merge pull request #258476 from Artturin/bootstrapthingies2 2023-10-02 09:10:31 +03:00
native stdenv: fix stagesNative 2023-07-02 19:07:23 +10:00
nix stdenv/common-path.nix: move to stdenv/generic/ 2022-07-29 18:24:00 -04:00
tests stdenv.tests: Add succeedOnFailure 2022-11-14 19:03:35 +01:00
adapters.nix makeStaticBinaries: Set -DCMAKE_SKIP_INSTALL_RPATH 2023-09-03 18:30:59 +01:00
booter.nix pkgs/stdenv: fix typo in booter.nix docs 2023-09-04 22:24:12 +02:00
default.nix darwin.stdenv: refactor stdenv definition 2023-07-02 17:56:24 -04:00