freshBootstrapTools: remove top-level `with` statement

+72 -63
+72 -63
pkgs/stdenv/darwin/make-bootstrap-tools.nix
··· 1 - { pkgspath ? ../../.., test-pkgspath ? pkgspath 2 - , localSystem ? { system = builtins.currentSystem; } 3 - , crossSystem ? null 4 - , bootstrapFiles ? null 1 + { 2 + pkgspath ? ../../.., 3 + test-pkgspath ? pkgspath, 4 + localSystem ? { 5 + system = builtins.currentSystem; 6 + }, 7 + crossSystem ? null, 8 + bootstrapFiles ? null, 5 9 }: 6 10 7 - let cross = if crossSystem != null 8 - then { inherit crossSystem; } 9 - else {}; 10 - custom-bootstrap = if bootstrapFiles != null 11 - then { stdenvStages = args: 12 - let args' = args // { bootstrapFiles = bootstrapFiles; }; 13 - in (import "${pkgspath}/pkgs/stdenv/darwin" args'); 14 - } 15 - else {}; 16 - in with import pkgspath ({ inherit localSystem; } // cross // custom-bootstrap); 11 + let 12 + cross = if crossSystem != null 13 + then { inherit crossSystem; } 14 + else {}; 15 + 16 + custom-bootstrap = if bootstrapFiles != null 17 + then { stdenvStages = args: 18 + let args' = args // { bootstrapFiles = bootstrapFiles; }; 19 + in (import "${pkgspath}/pkgs/stdenv/darwin" args'); 20 + } 21 + else {}; 22 + 23 + pkgs = import pkgspath ({ inherit localSystem; } // cross // custom-bootstrap); 24 + inherit (pkgs) lib stdenv darwin; 25 + in 17 26 18 27 rec { 19 28 build = stdenv.mkDerivation { 20 29 name = "stdenv-bootstrap-tools"; 21 30 22 - nativeBuildInputs = [ dumpnar nukeReferences ]; 31 + nativeBuildInputs = [ pkgs.dumpnar pkgs.nukeReferences ]; 23 32 24 33 buildCommand = let 25 34 inherit (lib) ··· 28 37 getLib 29 38 ; 30 39 31 - coreutils_ = (coreutils.override (args: { 40 + coreutils_ = (pkgs.coreutils.override (args: { 32 41 # We want coreutils without ACL support. 33 42 aclSupport = false; 34 43 # Cannot use a single binary build, or it gets dynamically linked against gmp. ··· 41 50 }); 42 51 43 52 # Avoid messing with libkrb5 and libnghttp2. 44 - curl_ = curlMinimal.override (args: { 53 + curl_ = pkgs.curlMinimal.override (args: { 45 54 gssSupport = false; 46 55 http2Support = false; 47 56 scpSupport = false; 48 57 }); 49 58 50 - unpackScript = writeText "bootstrap-tools-unpack.sh" '' 59 + unpackScript = pkgs.writeText "bootstrap-tools-unpack.sh" '' 51 60 set -euo pipefail 52 61 53 62 echo Unpacking the bootstrap tools... >&2 ··· 104 113 105 114 cp -rL ${getDev darwin.Libsystem}/include $out 106 115 chmod -R u+w $out/include 107 - cp -rL ${getDev libiconv}/include/* $out/include 108 - cp -rL ${getDev gnugrep.pcre2}/include/* $out/include 116 + cp -rL ${getDev pkgs.libiconv}/include/* $out/include 117 + cp -rL ${getDev pkgs.gnugrep.pcre2}/include/* $out/include 109 118 mv $out/include $out/include-Libsystem 110 119 111 120 # Copy binutils. ··· 118 127 cp ${getBin coreutils_}/bin/* $out/bin 119 128 (cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users) 120 129 121 - cp -d ${getBin bash}/bin/{ba,}sh $out/bin 122 - cp -d ${getBin diffutils}/bin/* $out/bin 123 - cp ${getBin findutils}/bin/{find,xargs} $out/bin 124 - cp -d ${getBin gawk}/bin/{g,}awk $out/bin 125 - cp -d ${getBin gnugrep}/bin/grep $out/bin 126 - cp -d ${getBin gnumake}/bin/* $out/bin 127 - cp -d ${getBin gnused}/bin/* $out/bin 128 - cp -d ${getBin patch}/bin/* $out/bin 130 + cp -d ${getBin pkgs.bash}/bin/{ba,}sh $out/bin 131 + cp -d ${getBin pkgs.diffutils}/bin/* $out/bin 132 + cp ${getBin pkgs.findutils}/bin/{find,xargs} $out/bin 133 + cp -d ${getBin pkgs.gawk}/bin/{g,}awk $out/bin 134 + cp -d ${getBin pkgs.gnugrep}/bin/grep $out/bin 135 + cp -d ${getBin pkgs.gnumake}/bin/* $out/bin 136 + cp -d ${getBin pkgs.gnused}/bin/* $out/bin 137 + cp -d ${getBin pkgs.patch}/bin/* $out/bin 129 138 130 - cp -d ${getLib gettext}/lib/libintl*.dylib $out/lib 131 - cp -d ${getLib gnugrep.pcre2}/lib/libpcre2*.dylib $out/lib 132 - cp -d ${getLib libiconv}/lib/lib*.dylib $out/lib 133 - cp -d ${getLib libxml2}/lib/libxml2*.dylib $out/lib 134 - cp -d ${getLib ncurses}/lib/libncurses*.dylib $out/lib 139 + cp -d ${getLib pkgs.gettext}/lib/libintl*.dylib $out/lib 140 + cp -d ${getLib pkgs.gnugrep.pcre2}/lib/libpcre2*.dylib $out/lib 141 + cp -d ${getLib pkgs.libiconv}/lib/lib*.dylib $out/lib 142 + cp -d ${getLib pkgs.libxml2}/lib/libxml2*.dylib $out/lib 143 + cp -d ${getLib pkgs.ncurses}/lib/libncurses*.dylib $out/lib 135 144 136 145 # copy package extraction tools 137 - cp -d ${getBin bzip2}/bin/b{,un}zip2 $out/bin 138 - cp ${getBin cpio}/bin/cpio $out/bin 139 - cp ${getBin gnutar}/bin/tar $out/bin 140 - cp ${getBin gzip}/bin/.gzip-wrapped $out/bin/gzip 141 - cp ${getBin pbzx}/bin/pbzx $out/bin 142 - cp ${getBin xz}/bin/xz $out/bin 143 - cp -d ${getLib bzip2}/lib/libbz2*.dylib $out/lib 144 - cp -d ${getLib gmpxx}/lib/libgmp*.dylib $out/lib 145 - cp -d ${getLib xar}/lib/libxar*.dylib $out/lib 146 - cp -d ${getLib xz}/lib/liblzma*.dylib $out/lib 147 - cp -d ${getLib zlib}/lib/libz*.dylib $out/lib 146 + cp -d ${getBin pkgs.bzip2}/bin/b{,un}zip2 $out/bin 147 + cp ${getBin pkgs.cpio}/bin/cpio $out/bin 148 + cp ${getBin pkgs.gnutar}/bin/tar $out/bin 149 + cp ${getBin pkgs.gzip}/bin/.gzip-wrapped $out/bin/gzip 150 + cp ${getBin pkgs.pbzx}/bin/pbzx $out/bin 151 + cp ${getBin pkgs.xz}/bin/xz $out/bin 152 + cp -d ${getLib pkgs.bzip2}/lib/libbz2*.dylib $out/lib 153 + cp -d ${getLib pkgs.gmpxx}/lib/libgmp*.dylib $out/lib 154 + cp -d ${getLib pkgs.xar}/lib/libxar*.dylib $out/lib 155 + cp -d ${getLib pkgs.xz}/lib/liblzma*.dylib $out/lib 156 + cp -d ${getLib pkgs.zlib}/lib/libz*.dylib $out/lib 148 157 149 158 # This used to be in-nixpkgs, but now is in the bundle 150 159 # because I can't be bothered to make it partially static 151 160 cp ${getBin curl_}/bin/curl $out/bin 152 161 cp -d ${getLib curl_}/lib/libcurl*.dylib $out/lib 153 - cp -d ${getLib openssl}/lib/*.dylib $out/lib 162 + cp -d ${getLib pkgs.openssl}/lib/*.dylib $out/lib 154 163 155 164 # Copy what we need of clang 156 - cp -d ${getBin llvmPackages.clang-unwrapped}/bin/clang{,++,-cl,-cpp,-[0-9]*} $out/bin 157 - cp -d ${getLib llvmPackages.clang-unwrapped}/lib/libclang-cpp*.dylib $out/lib 158 - cp -rd ${getLib llvmPackages.clang-unwrapped}/lib/clang $out/lib 165 + cp -d ${getBin pkgs.llvmPackages.clang-unwrapped}/bin/clang{,++,-cl,-cpp,-[0-9]*} $out/bin 166 + cp -d ${getLib pkgs.llvmPackages.clang-unwrapped}/lib/libclang-cpp*.dylib $out/lib 167 + cp -rd ${getLib pkgs.llvmPackages.clang-unwrapped}/lib/clang $out/lib 159 168 160 - cp -d ${getLib llvmPackages.libcxx}/lib/libc++*.dylib $out/lib 169 + cp -d ${getLib pkgs.llvmPackages.libcxx}/lib/libc++*.dylib $out/lib 161 170 mkdir -p $out/lib/darwin 162 - cp -d ${getLib llvmPackages.compiler-rt}/lib/darwin/libclang_rt.{,profile_}osx.a $out/lib/darwin 163 - cp -d ${getLib llvmPackages.compiler-rt}/lib/libclang_rt.{,profile_}osx.a $out/lib 164 - cp -d ${getLib llvmPackages.llvm}/lib/libLLVM.dylib $out/lib 165 - cp -d ${getLib libffi}/lib/libffi*.dylib $out/lib 171 + cp -d ${getLib pkgs.llvmPackages.compiler-rt}/lib/darwin/libclang_rt.{,profile_}osx.a $out/lib/darwin 172 + cp -d ${getLib pkgs.llvmPackages.compiler-rt}/lib/libclang_rt.{,profile_}osx.a $out/lib 173 + cp -d ${getLib pkgs.llvmPackages.llvm}/lib/libLLVM.dylib $out/lib 174 + cp -d ${getLib pkgs.libffi}/lib/libffi*.dylib $out/lib 166 175 167 176 mkdir $out/include 168 - cp -rd ${getDev llvmPackages.libcxx}/include/c++ $out/include 177 + cp -rd ${getDev pkgs.llvmPackages.libcxx}/include/c++ $out/include 169 178 170 179 # copy .tbd assembly utils 171 180 cp ${getBin darwin.rewrite-tbd}/bin/rewrite-tbd $out/bin 172 - cp -d ${getLib libyaml}/lib/libyaml*.dylib $out/lib 181 + cp -d ${getLib pkgs.libyaml}/lib/libyaml*.dylib $out/lib 173 182 174 183 # copy sigtool 175 184 cp -d ${getBin darwin.sigtool}/bin/{codesign,sigtool} $out/bin ··· 178 187 179 188 # tools needed to unpack bootstrap archive 180 189 mkdir -p unpack/bin unpack/lib 181 - cp -d ${getBin bash}/bin/{bash,sh} unpack/bin 190 + cp -d ${getBin pkgs.bash}/bin/{bash,sh} unpack/bin 182 191 cp ${getBin coreutils_}/bin/mkdir unpack/bin 183 - cp ${getBin gnutar}/bin/tar unpack/bin 184 - cp ${getBin xz}/bin/xz unpack/bin 185 - cp -d ${getLib gettext}/lib/libintl*.dylib unpack/lib 186 - cp -d ${getLib libiconv}/lib/lib*.dylib unpack/lib 187 - cp -d ${getLib xz}/lib/liblzma*.dylib unpack/lib 192 + cp ${getBin pkgs.gnutar}/bin/tar unpack/bin 193 + cp ${getBin pkgs.xz}/bin/xz unpack/bin 194 + cp -d ${getLib pkgs.gettext}/lib/libintl*.dylib unpack/lib 195 + cp -d ${getLib pkgs.libiconv}/lib/lib*.dylib unpack/lib 196 + cp -d ${getLib pkgs.xz}/lib/liblzma*.dylib unpack/lib 188 197 cp ${unpackScript} unpack/bootstrap-tools-unpack.sh 189 198 190 199 # ··· 277 286 278 287 bootstrapFiles = { 279 288 bootstrapTools = "${build}/on-server/bootstrap-tools.tar.xz"; 280 - unpack = runCommand "unpack" { allowedReferences = []; } '' 289 + unpack = pkgs.runCommand "unpack" { allowedReferences = []; } '' 281 290 cp -r ${build}/unpack $out 282 291 ''; 283 292 }; ··· 383 392 clang++ -Wl,-flat_namespace -idirafter $tools/include-Libsystem -isystem$tools/include/c++/v1 \ 384 393 --sysroot=$tools -L./libtest -L$PWD/libSystem-boot hello3.cc 385 394 386 - tar xvf ${hello.src} 395 + tar xvf ${pkgs.hello.src} 387 396 cd hello-* 388 397 # hello configure detects -liconv is needed but doesn't add to the link step 389 398 LDFLAGS=-liconv ./configure --prefix=$out