nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 77 lines 2.2 kB view raw
1{ lib 2, stdenv 3, callPackage 4, fetchpatch 5, swift 6, swiftpm 7, swiftpm2nix 8, Foundation 9, XCTest 10, sqlite 11, ncurses 12, substituteAll 13}: 14let 15 sources = callPackage ../sources.nix { }; 16 generated = swiftpm2nix.helpers ./generated; 17 18 # On Darwin, we only want ncurses in the linker search path, because headers 19 # are part of libsystem. Adding its headers to the search path causes strange 20 # mixing and errors. 21 # TODO: Find a better way to prevent this conflict. 22 ncursesInput = if stdenv.isDarwin then ncurses.out else ncurses; 23in 24stdenv.mkDerivation { 25 pname = "swift-driver"; 26 27 inherit (sources) version; 28 src = sources.swift-driver; 29 30 nativeBuildInputs = [ swift swiftpm ]; 31 buildInputs = [ 32 Foundation 33 XCTest 34 sqlite 35 ncursesInput 36 ]; 37 38 patches = [ 39 ./patches/nix-resource-root.patch 40 ./patches/disable-catalyst.patch 41 ./patches/linux-fix-linking.patch 42 # TODO: Replace with branch patch once merged: 43 # https://github.com/apple/swift-driver/pull/1197 44 (fetchpatch { 45 url = "https://github.com/apple/swift-driver/commit/d3ef9cdf4871a58eddec7ff0e28fe611130da3f9.patch"; 46 hash = "sha256-eVBaKN6uzj48ZnHtwGV0k5ChKjak1tDCyE+wTdyGq2c="; 47 }) 48 # Prevent a warning about SDK directories we don't have. 49 (substituteAll { 50 src = ./patches/prevent-sdk-dirs-warnings.patch; 51 inherit (builtins) storeDir; 52 }) 53 ]; 54 55 configurePhase = generated.configure; 56 57 # TODO: Tests depend on indexstore-db being provided by an existing Swift 58 # toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc. 59 #doCheck = true; 60 61 # TODO: Darwin-specific installation includes more, but not sure why. 62 installPhase = '' 63 binPath="$(swiftpmBinPath)" 64 mkdir -p $out/bin 65 for executable in swift-driver swift-help swift-build-sdk-interfaces; do 66 cp $binPath/$executable $out/bin/ 67 done 68 ''; 69 70 meta = { 71 description = "Swift compiler driver"; 72 homepage = "https://github.com/apple/swift-driver"; 73 platforms = with lib.platforms; linux ++ darwin; 74 license = lib.licenses.asl20; 75 maintainers = with lib.maintainers; [ dtzWill trepetti dduan trundle stephank ]; 76 }; 77}