Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 220 lines 6.7 kB view raw
1{ 2 lib, 3 buildPackages, 4 pkgs, 5 targetPackages, 6 generateSplicesForMkScope, 7 makeScopeWithSplicing', 8 stdenv, 9 config, 10}: 11 12let 13 aliases = 14 self: super: 15 lib.optionalAttrs config.allowAliases (import ../top-level/darwin-aliases.nix lib self super pkgs); 16 17 mkBootstrapStdenv = 18 stdenv: 19 stdenv.override (old: { 20 extraBuildInputs = map ( 21 pkg: 22 if lib.isDerivation pkg && lib.getName pkg == "apple-sdk" then 23 pkg.override { enableBootstrap = true; } 24 else 25 pkg 26 ) (old.extraBuildInputs or [ ]); 27 }); 28in 29 30makeScopeWithSplicing' { 31 otherSplices = generateSplicesForMkScope "darwin"; 32 f = lib.extends aliases ( 33 self: 34 let 35 inherit (self) mkDerivation callPackage; 36 37 # Open source packages that are built from source 38 apple-source-packages = lib.packagesFromDirectoryRecursive { 39 callPackage = self.callPackage; 40 directory = ../os-specific/darwin/apple-source-releases; 41 }; 42 43 # Must use pkgs.callPackage to avoid infinite recursion. 44 impure-cmds = pkgs.callPackage ../os-specific/darwin/impure-cmds { }; 45 in 46 47 lib.recurseIntoAttrs ( 48 impure-cmds 49 // apple-source-packages 50 // { 51 52 inherit (self.adv_cmds) ps; 53 54 binutils-unwrapped = callPackage ../os-specific/darwin/binutils { 55 inherit (pkgs) cctools; 56 inherit (pkgs.llvmPackages) clang-unwrapped llvm llvm-manpages; 57 }; 58 59 binutils = pkgs.wrapBintoolsWith { 60 inherit (targetPackages) libc; 61 bintools = self.binutils-unwrapped; 62 }; 63 64 # x86-64 Darwin gnat-bootstrap emits assembly 65 # with MOVQ as the mnemonic for quadword interunit moves 66 # such as `movq %rbp, %xmm0`. 67 # The clang integrated assembler recognises this as valid, 68 # but unfortunately the cctools.gas GNU assembler does not; 69 # it instead uses MOVD as the mnemonic. 70 # The assembly that a GCC build emits is determined at build time 71 # and cannot be changed afterwards. 72 # 73 # To build GNAT on x86-64 Darwin, therefore, 74 # we need both the clang _and_ the cctools.gas assemblers to be available: 75 # the former to build at least the stage1 compiler, 76 # and the latter at least to be detectable 77 # as the target for the final compiler. 78 binutilsDualAs-unwrapped = pkgs.buildEnv { 79 name = "${lib.getName self.binutils-unwrapped}-dualas-${lib.getVersion self.binutils-unwrapped}"; 80 paths = [ 81 self.binutils-unwrapped 82 (lib.getOutput "gas" pkgs.cctools) 83 ]; 84 }; 85 86 binutilsDualAs = self.binutils.override { 87 bintools = self.binutilsDualAs-unwrapped; 88 }; 89 90 binutilsNoLibc = pkgs.wrapBintoolsWith { 91 libc = targetPackages.preLibcHeaders; 92 bintools = self.binutils-unwrapped; 93 }; 94 95 # Removes propagated packages from the stdenv, so those packages can be built without depending upon themselves. 96 bootstrapStdenv = mkBootstrapStdenv pkgs.stdenv; 97 98 libSystem = callPackage ../os-specific/darwin/libSystem { }; 99 100 DarwinTools = callPackage ../os-specific/darwin/DarwinTools { }; 101 102 libunwind = callPackage ../os-specific/darwin/libunwind { }; 103 104 sigtool = callPackage ../os-specific/darwin/sigtool { }; 105 106 signingUtils = callPackage ../os-specific/darwin/signing-utils { }; 107 108 autoSignDarwinBinariesHook = pkgs.makeSetupHook { 109 name = "auto-sign-darwin-binaries-hook"; 110 propagatedBuildInputs = [ self.signingUtils ]; 111 } ../os-specific/darwin/signing-utils/auto-sign-hook.sh; 112 113 iosSdkPkgs = callPackage ../os-specific/darwin/xcode/sdk-pkgs.nix { 114 buildIosSdk = buildPackages.darwin.iosSdkPkgs.sdk; 115 targetIosSdkPkgs = targetPackages.darwin.iosSdkPkgs; 116 inherit (pkgs.llvmPackages) clang-unwrapped; 117 }; 118 119 lsusb = callPackage ../os-specific/darwin/lsusb { }; 120 121 openwith = callPackage ../os-specific/darwin/openwith { }; 122 123 trash = callPackage ../os-specific/darwin/trash { }; 124 125 inherit (self.file_cmds) xattr; 126 127 inherit (pkgs.callPackages ../os-specific/darwin/xcode { }) 128 xcode_8_1 129 xcode_8_2 130 xcode_9_1 131 xcode_9_2 132 xcode_9_3 133 xcode_9_4 134 xcode_9_4_1 135 xcode_10_1 136 xcode_10_2 137 xcode_10_2_1 138 xcode_10_3 139 xcode_11 140 xcode_11_1 141 xcode_11_2 142 xcode_11_3_1 143 xcode_11_4 144 xcode_11_5 145 xcode_11_6 146 xcode_11_7 147 xcode_12 148 xcode_12_0_1 149 xcode_12_1 150 xcode_12_2 151 xcode_12_3 152 xcode_12_4 153 xcode_12_5 154 xcode_12_5_1 155 xcode_13 156 xcode_13_1 157 xcode_13_2 158 xcode_13_3 159 xcode_13_3_1 160 xcode_13_4 161 xcode_13_4_1 162 xcode_14 163 xcode_14_1 164 xcode_15 165 xcode_15_0_1 166 xcode_15_1 167 xcode_15_2 168 xcode_15_3 169 xcode_15_4 170 xcode_16 171 xcode_16_1 172 xcode_16_2 173 xcode_16_3 174 xcode_16_4 175 xcode 176 requireXcode 177 ; 178 179 xcodeProjectCheckHook = pkgs.makeSetupHook { 180 name = "xcode-project-check-hook"; 181 propagatedBuildInputs = [ pkgs.pkgsBuildHost.openssl ]; 182 } ../os-specific/darwin/xcode-project-check-hook/setup-hook.sh; 183 184 # See doc/packages/darwin-builder.section.md 185 linux-builder = lib.makeOverridable ( 186 { modules }: 187 let 188 toGuest = builtins.replaceStrings [ "darwin" ] [ "linux" ]; 189 190 nixos = import ../../nixos { 191 configuration = { 192 imports = [ 193 ../../nixos/modules/profiles/nix-builder-vm.nix 194 ] 195 ++ modules; 196 197 # If you need to override this, consider starting with the right Nixpkgs 198 # in the first place, ie change `pkgs` in `pkgs.darwin.linux-builder`. 199 # or if you're creating new wiring that's not `pkgs`-centric, perhaps use the 200 # macos-builder profile directly. 201 virtualisation.host = { inherit pkgs; }; 202 203 nixpkgs.hostPlatform = lib.mkDefault (toGuest stdenv.hostPlatform.system); 204 }; 205 206 system = null; 207 }; 208 209 in 210 nixos.config.system.build.macos-builder-installer 211 ) { modules = [ ]; }; 212 213 linux-builder-x86_64 = self.linux-builder.override { 214 modules = [ { nixpkgs.hostPlatform = "x86_64-linux"; } ]; 215 }; 216 217 } 218 ) 219 ); 220}