at master 87 lines 2.0 kB view raw
1{ 2 pkgs ? import ../../.. { }, 3}: 4 5let 6 inherit (pkgs) 7 lib 8 stdenv 9 config 10 libc 11 ; 12 13 patchelf = pkgs.patchelf.overrideAttrs (previousAttrs: { 14 NIX_CFLAGS_COMPILE = (previousAttrs.NIX_CFLAGS_COMPILE or [ ]) ++ [ 15 "-static-libgcc" 16 "-static-libstdc++" 17 ]; 18 NIX_CFLAGS_LINK = (previousAttrs.NIX_CFLAGS_LINK or [ ]) ++ [ 19 "-static-libgcc" 20 "-static-libstdc++" 21 ]; 22 }); 23in 24rec { 25 coreutilsMinimal = pkgs.coreutils.override (args: { 26 # We want coreutils without ACL/attr support. 27 aclSupport = false; 28 attrSupport = false; 29 # Our tooling currently can't handle scripts in bin/, only ELFs and symlinks. 30 singleBinary = "symlinks"; 31 }); 32 33 tarMinimal = pkgs.gnutar.override { acl = null; }; 34 35 busyboxMinimal = pkgs.busybox.override { 36 useMusl = lib.meta.availableOn stdenv.hostPlatform pkgs.musl; 37 enableStatic = true; 38 enableMinimal = true; 39 extraConfig = '' 40 CONFIG_ASH y 41 CONFIG_ASH_ECHO y 42 CONFIG_ASH_TEST y 43 CONFIG_ASH_OPTIMIZE_FOR_SIZE y 44 CONFIG_MKDIR y 45 CONFIG_TAR y 46 CONFIG_UNXZ y 47 ''; 48 }; 49 50 bootGCC = pkgs.gcc.cc.override { 51 enableLTO = false; 52 isl = null; 53 }; 54 55 bootBinutils = pkgs.binutils.bintools.override { 56 withAllTargets = false; 57 # Don't need two linkers, disable whatever's not primary/default. 58 enableGold = false; 59 # bootstrap is easier w/static 60 enableShared = false; 61 }; 62 63 build = pkgs.callPackage ./stdenv-bootstrap-tools.nix { 64 inherit 65 bootBinutils 66 coreutilsMinimal 67 tarMinimal 68 busyboxMinimal 69 bootGCC 70 libc 71 patchelf 72 ; 73 }; 74 75 inherit (build) bootstrapFiles; 76 77 bootstrapTools = import ./bootstrap-tools { 78 inherit (stdenv.buildPlatform) system; # Used to determine where to build 79 inherit (stdenv.hostPlatform) libc; 80 inherit lib bootstrapFiles config; 81 }; 82 83 test = pkgs.callPackage ./test-bootstrap-tools.nix { 84 inherit bootstrapTools; 85 inherit (bootstrapFiles) busybox; 86 }; 87}