diff options
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/adapters.nix | 13 | ||||
-rw-r--r-- | pkgs/stdenv/darwin/default.nix | 58 | ||||
-rw-r--r-- | pkgs/stdenv/generic/default-builder.sh | 4 | ||||
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 17 |
4 files changed, 54 insertions, 38 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index f7d7053c77a..7c64fd7e392 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -60,12 +60,13 @@ rec { mkDerivationFromStdenv = withOldMkDerivation old (stdenv: mkDerivationSuper: args: if stdenv.hostPlatform.isDarwin then throw "Cannot build fully static binaries on Darwin/macOS" - else (mkDerivationSuper args).overrideAttrs(finalAttrs: { - NIX_CFLAGS_LINK = toString (finalAttrs.NIX_CFLAGS_LINK or "") + " -static"; - } // lib.optionalAttrs (!(finalAttrs.dontAddStaticConfigureFlags or false)) { - configureFlags = (finalAttrs.configureFlags or []) ++ [ - "--disable-shared" # brrr... - ]; + else (mkDerivationSuper args).overrideAttrs (args: { + NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -static"; + } // lib.optionalAttrs (!(args.dontAddStaticConfigureFlags or false)) { + configureFlags = (args.configureFlags or []) ++ [ + "--disable-shared" # brrr... + ]; + cmakeFlags = (args.cmakeFlags or []) ++ ["-DCMAKE_SKIP_INSTALL_RPATH=On"]; })); } // lib.optionalAttrs (stdenv0.hostPlatform.libc == "glibc") { extraBuildInputs = (old.extraBuildInputs or []) ++ [ diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 25a80fd11aa..9ee6dfb1080 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -1047,9 +1047,9 @@ in overrides = self: super: { inherit (prevStage) ccWrapperStdenv - autoconf automake bash bison cmake cmakeMinimal cpio cyrus_sasl db expat flex groff - libedit libtool m4 ninja openldap openssh patchutils pbzx perl pkg-config python3 - python3Minimal scons serf sqlite subversion sysctl texinfo unzip which + autoconf automake bash bison cmake cmakeMinimal cyrus_sasl db expat flex groff + libedit libtool m4 ninja openldap openssh patchutils perl pkg-config python3 scons + serf sqlite subversion sysctl texinfo unzip which # CF dependencies - don’t rebuild them. icu @@ -1057,11 +1057,40 @@ in # LLVM dependencies - don’t rebuild them. libffi libiconv libxml2 ncurses zlib; + # These overrides are required to break an infinite recursion. curl depends on Darwin + # frameworks, but those frameworks require these dependencies to build, which + # depend on curl indirectly. + cpio = super.cpio.override { + inherit (prevStage) fetchurl; + }; + + libyaml = super.libyaml.override { + inherit (prevStage) fetchFromGitHub; + }; + + pbzx = super.pbzx.override { + inherit (prevStage) fetchFromGitHub; + }; + + python3Minimal = super.python3Minimal.override { + inherit (prevStage) fetchurl; + }; + + xar = super.xar.override { + inherit (prevStage) fetchurl; + }; + darwin = super.darwin.overrideScope (selfDarwin: superDarwin: { inherit (prevStage.darwin) dyld CF Libsystem darwin-stubs # CF dependencies - don’t rebuild them. libobjc objc4; + # rewrite-tbd is also needed to build Darwin frameworks, so it’s built using the + # previous stage’s fetchFromGitHub to avoid an infinite recursion (same as above). + rewrite-tbd = superDarwin.rewrite-tbd.override { + inherit (prevStage) fetchFromGitHub; + }; + signingUtils = superDarwin.signingUtils.override { inherit (selfDarwin) sigtool; }; @@ -1158,9 +1187,10 @@ in (prevStage: # previous stage4 stdenv: assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [ - bash binutils-unwrapped brotli bzip2 curl diffutils ed file findutils gawk gettext gmp - gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libkrb5 libssh2 - libunistring libxml2 ncurses nghttp2 openbsm openpam openssl patch pcre xz zlib zstd + bash binutils-unwrapped brotli bzip2 cpio curl diffutils ed file findutils gawk + gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libkrb5 + libssh2 libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch + pbzx pcre python3Minimal xar xz zlib zstd ]); assert lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ @@ -1176,9 +1206,9 @@ in ]); assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [ - autoconf automake bison cmake cmakeMinimal cpio cyrus_sasl db expat flex groff libedit - libtool m4 ninja openldap openssh patchutils pbzx perl pkg-config.pkg-config python3 - python3Minimal scons serf sqlite subversion sysctl.provider texinfo unzip which + autoconf automake bison cmake cmakeMinimal cyrus_sasl db expat flex groff libedit + libtool m4 ninja openldap openssh patchutils perl pkg-config.pkg-config python3 scons + serf sqlite subversion sysctl.provider texinfo unzip which ]); assert prevStage.darwin.cctools == prevStage.darwin.cctools-llvm; @@ -1307,14 +1337,14 @@ in overrides = self: super: { inherit (prevStage) - bash binutils brotli bzip2 coreutils curl diffutils ed file findutils gawk gettext - gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libssh2 - libunistring libxml2 ncurses nghttp2 openbsm openpam openssl patch pcre xz zlib - zstd; + bash binutils brotli bzip2 coreutils cpio curl diffutils ed file findutils gawk + gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libssh2 + libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch pbzx + pcre python3Minimal xar xz zlib zstd; darwin = super.darwin.overrideScope (_: _: { inherit (prevStage.darwin) - CF ICU Libsystem darwin-stubs dyld locale libobjc libtapi xnu; + CF ICU Libsystem darwin-stubs dyld locale libobjc libtapi rewrite-tbd xnu; } // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { inherit (prevStage.darwin) binutils binutils-unwrapped cctools-llvm cctools-port; }); diff --git a/pkgs/stdenv/generic/default-builder.sh b/pkgs/stdenv/generic/default-builder.sh index 8c6fec7873b..d49fb8aa57f 100644 --- a/pkgs/stdenv/generic/default-builder.sh +++ b/pkgs/stdenv/generic/default-builder.sh @@ -1,6 +1,4 @@ -if [ -f .attrs.sh ]; then - . .attrs.sh -fi +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi source $stdenv/setup genericBuild diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index ad9857fc9d6..419a66261e6 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -16,29 +16,15 @@ if (( "${NIX_DEBUG:-0}" >= 6 )); then set -x fi -if [ -f .attrs.sh ]; then +if [ -f .attrs.sh ] || [[ -n "${NIX_ATTRS_JSON_FILE:-}" ]]; then __structuredAttrs=1 echo "structuredAttrs is enabled" -else - __structuredAttrs= -fi -if [ -n "$__structuredAttrs" ]; then for outputName in "${!outputs[@]}"; do # ex: out=/nix/store/... export "$outputName=${outputs[$outputName]}" done - # Before Nix 2.4, $NIX_ATTRS_*_FILE was named differently: - # https://github.com/NixOS/nix/commit/27ce722 - if [[ -n "${ATTRS_JSON_FILE:-}" ]]; then - export NIX_ATTRS_JSON_FILE="$ATTRS_JSON_FILE" - fi - - if [[ -n "${ATTRS_SH_FILE:-}" ]]; then - export NIX_ATTRS_SH_FILE="$ATTRS_SH_FILE" - fi - # $NIX_ATTRS_JSON_FILE pointed to the wrong location in sandbox # https://github.com/NixOS/nix/issues/6736; please keep around until the # fix reaches *every patch version* that's >= lib/minver.nix @@ -49,6 +35,7 @@ if [ -n "$__structuredAttrs" ]; then export NIX_ATTRS_SH_FILE="$NIX_BUILD_TOP/.attrs.sh" fi else + __structuredAttrs= : "${outputs:=out}" fi |