From 9aafa9b258a66344b52737c5cbb7fb9ea3088015 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Mon, 24 Jul 2023 21:11:03 +1000 Subject: [PATCH 1/3] darwin.apple_sdk_11_0.libcompression: init at 11.0.0 --- .../darwin/apple-sdk-11.0/default.nix | 1 + .../darwin/apple-sdk-11.0/libcompression.nix | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 pkgs/os-specific/darwin/apple-sdk-11.0/libcompression.nix diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix index fe0d0ca63ea9..a02445adb33b 100644 --- a/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix +++ b/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix @@ -94,6 +94,7 @@ let Libsystem = callPackage ./libSystem.nix { }; LibsystemCross = pkgs.darwin.Libsystem; libcharset = callPackage ./libcharset.nix { }; + libcompression = callPackage ./libcompression.nix { }; libunwind = callPackage ./libunwind.nix { }; libnetwork = callPackage ./libnetwork.nix { }; libpm = callPackage ./libpm.nix { }; diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/libcompression.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/libcompression.nix new file mode 100644 index 000000000000..92a45b7c5a50 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-11.0/libcompression.nix @@ -0,0 +1,20 @@ +{ stdenvNoCC, buildPackages, MacOSX-SDK }: + +let self = stdenvNoCC.mkDerivation { + pname = "libcompression"; + version = MacOSX-SDK.version; + + dontUnpack = true; + dontBuild = true; + + installPhase = '' + mkdir -p $out/lib + cp ${MacOSX-SDK}/usr/lib/libcompression* $out/lib + ''; + + passthru = { + tbdRewrites = { + const."/usr/lib/libcompression.dylib" = "${self}/lib/libcompression.dylib"; + }; + }; +}; in self From b732363eedbc406446521e8193dc889e5beb5162 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Sun, 31 Dec 2023 13:39:00 +1100 Subject: [PATCH 2/3] swiftpm2nix: fix hash mismatch when git submodules exist --- pkgs/development/tools/swiftpm2nix/support.nix | 1 + pkgs/development/tools/swiftpm2nix/swiftpm2nix.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/swiftpm2nix/support.nix b/pkgs/development/tools/swiftpm2nix/support.nix index 9b944a133daa..dfc2d01a4501 100644 --- a/pkgs/development/tools/swiftpm2nix/support.nix +++ b/pkgs/development/tools/swiftpm2nix/support.nix @@ -29,6 +29,7 @@ in rec { url = dep.packageRef.location; rev = dep.state.checkoutState.revision; sha256 = hashes.${dep.subpath}; + fetchSubmodules = true; })) workspaceState.object.dependencies ); diff --git a/pkgs/development/tools/swiftpm2nix/swiftpm2nix.sh b/pkgs/development/tools/swiftpm2nix/swiftpm2nix.sh index db00b1ad2b52..eda7f475064a 100755 --- a/pkgs/development/tools/swiftpm2nix/swiftpm2nix.sh +++ b/pkgs/development/tools/swiftpm2nix/swiftpm2nix.sh @@ -23,7 +23,7 @@ hashes="" jq -r '.object.dependencies[] | "\(.subpath) \(.packageRef.location) \(.state.checkoutState.revision)"' $stateFile \ | while read -r name url rev; do echo >&2 "-- Fetching $name" - sha256="$(nix-prefetch-git $url $rev | jq -r .sha256)" + sha256="$(nix-prefetch-git --fetch-submodules $url $rev | jq -r .sha256)" hashes+=" \"$name\" = \"$sha256\";" echo >&2 From 677e0a4620e0738fec2e195b0ec1f4308e6b3e57 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Tue, 25 Jul 2023 02:47:12 +1000 Subject: [PATCH 3/3] xcodes: build from source --- pkgs/development/tools/xcodes/default.nix | 59 ++++-- .../tools/xcodes/generated/default.nix | 17 ++ .../xcodes/generated/workspace-state.json | 194 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 5 +- 4 files changed, 254 insertions(+), 21 deletions(-) create mode 100644 pkgs/development/tools/xcodes/generated/default.nix create mode 100644 pkgs/development/tools/xcodes/generated/workspace-state.json diff --git a/pkgs/development/tools/xcodes/default.nix b/pkgs/development/tools/xcodes/default.nix index f10fd76aa020..a7449aa08651 100644 --- a/pkgs/development/tools/xcodes/default.nix +++ b/pkgs/development/tools/xcodes/default.nix @@ -1,41 +1,60 @@ -{ lib, stdenv, fetchurl, unzip }: - +{ lib +, stdenv +, fetchFromGitHub +, swift +, swiftpm +, swiftpm2nix +, makeWrapper +, CryptoKit +, LocalAuthentication +, libcompression +, aria2 +}: +let + generated = swiftpm2nix.helpers ./generated; +in stdenv.mkDerivation (finalAttrs: { pname = "xcodes"; version = "1.4.1"; - src = fetchurl { - url = "https://github.com/XcodesOrg/xcodes/releases/download/${finalAttrs.version}/xcodes.zip"; - hash = "sha256-PtXF2eqNfEX29EtXlcjdxrUs7BPn/YurUuFFeLpXwrk="; + src = fetchFromGitHub { + owner = "XcodesOrg"; + repo = finalAttrs.pname; + rev = finalAttrs.version; + hash = "sha256-ARrSQ9ozM90Yg7y4WdU7jjNQ64sXHuhxZh/iNJcFfY0="; }; - nativeBuildInputs = [ unzip ]; + nativeBuildInputs = [ swift swiftpm makeWrapper ]; - unpackPhase = '' - runHook preUnpack - unzip -q $src - runHook postUnpack - ''; + buildInputs = [ + CryptoKit + LocalAuthentication + libcompression + ]; - dontPatch = true; - dontConfigure = true; - dontBuild = true; + configurePhase = generated.configure; installPhase = '' runHook preInstall - mkdir -p $out/bin - install -m755 xcodes $out/bin/xcodes + + binPath="$(swiftpmBinPath)" + install -D $binPath/xcodes $out/bin/xcodes + wrapProgram $out/bin/xcodes \ + --prefix PATH : ${lib.makeBinPath [ aria2 ]} + runHook postInstall ''; - dontFixup = true; - meta = with lib; { changelog = "https://github.com/XcodesOrg/xcodes/releases/tag/${finalAttrs.version}"; description = "Command-line tool to install and switch between multiple versions of Xcode"; homepage = "https://github.com/XcodesOrg/xcodes"; - license = licenses.mit; - maintainers = with maintainers; [ _0x120581f ]; + license = with licenses; [ + mit + # unxip + lgpl3Only + ]; + maintainers = with maintainers; [ _0x120581f emilytrau ]; platforms = platforms.darwin; }; }) diff --git a/pkgs/development/tools/xcodes/generated/default.nix b/pkgs/development/tools/xcodes/generated/default.nix new file mode 100644 index 000000000000..32ec081a9380 --- /dev/null +++ b/pkgs/development/tools/xcodes/generated/default.nix @@ -0,0 +1,17 @@ +# This file was generated by swiftpm2nix. +{ + workspaceStateFile = ./workspace-state.json; + hashes = { + "data" = "1jf2y9dbg1qvxkkabdkihdnr1kmznq79h18j65a7iw1hljdp8hyg"; + "Foundation" = "0hcpc15v38l32qc2sh4gqj909b1f90knln9yz3mfiyf6xi7iy6q7"; + "KeychainAccess" = "0m57pq1vn5qarmlx5x4kfv0yzjylafl3ipih5p60zyfsx6k5b55l"; + "LegibleError" = "08x5agha74chq1z5c7c5r2vasdk81pyl2k085miapd4l3jszz4fj"; + "Path.swift" = "05qk7kwb1254zwdxc3sjc3gprccnv9fwapmy5y6ygxjz8a6jfk83"; + "PromiseKit" = "0vlkd4famjgbd4qs2ldi5aqg13nk77h7ddsdigyxxzgkwgxl076d"; + "Rainbow" = "0iv31azny668vpsjgmldgkgn9cp8i5h9rlc6w5bs8q63nwq19wb0"; + "swift-argument-parser" = "19b4pkcx4xf0iwg0nbr7wvkkbwl6h8sch848gid6l98728glmcw9"; + "SwiftSoup" = "14klizw8jhmxhxays1b1yh4bp0nbb3l4l1pj6sdnf0iqs0wladv8"; + "Version" = "0s5bwr1li6dnsnalfyraq1kzhqmmn9qwp1mld4msrn3q5vvjmql9"; + "Yams" = "11abhcfkmqm3cmh7vp7rqzvxd1zj02j2866a2pp6v9m89456xb76"; + }; +} diff --git a/pkgs/development/tools/xcodes/generated/workspace-state.json b/pkgs/development/tools/xcodes/generated/workspace-state.json new file mode 100644 index 000000000000..f13a3a54c6d4 --- /dev/null +++ b/pkgs/development/tools/xcodes/generated/workspace-state.json @@ -0,0 +1,194 @@ +{ + "object": { + "artifacts": [], + "dependencies": [ + { + "basedOn": null, + "packageRef": { + "identity": "data", + "kind": "remoteSourceControl", + "location": "https://github.com/xcodereleases/data", + "name": "XcodeReleases" + }, + "state": { + "checkoutState": { + "revision": "fcf527b187817f67c05223676341f3ab69d4214d" + }, + "name": "sourceControlCheckout" + }, + "subpath": "data" + }, + { + "basedOn": null, + "packageRef": { + "identity": "foundation", + "kind": "remoteSourceControl", + "location": "https://github.com/PromiseKit/Foundation.git", + "name": "PMKFoundation" + }, + "state": { + "checkoutState": { + "revision": "985f17fa69ee0e5b7eb3ff9be87ffc4e05fc0927", + "version": "3.4.0" + }, + "name": "sourceControlCheckout" + }, + "subpath": "Foundation" + }, + { + "basedOn": null, + "packageRef": { + "identity": "keychainaccess", + "kind": "remoteSourceControl", + "location": "https://github.com/kishikawakatsumi/KeychainAccess.git", + "name": "KeychainAccess" + }, + "state": { + "checkoutState": { + "revision": "8d33ffd6f74b3bcfc99af759d4204c6395a3f918", + "version": "3.2.1" + }, + "name": "sourceControlCheckout" + }, + "subpath": "KeychainAccess" + }, + { + "basedOn": null, + "packageRef": { + "identity": "legibleerror", + "kind": "remoteSourceControl", + "location": "https://github.com/mxcl/LegibleError.git", + "name": "LegibleError" + }, + "state": { + "checkoutState": { + "revision": "909e9bab3ded97350b28a5ab41dd745dd8aa9710", + "version": "1.0.4" + }, + "name": "sourceControlCheckout" + }, + "subpath": "LegibleError" + }, + { + "basedOn": null, + "packageRef": { + "identity": "path.swift", + "kind": "remoteSourceControl", + "location": "https://github.com/mxcl/Path.swift.git", + "name": "Path.swift" + }, + "state": { + "checkoutState": { + "revision": "dac007e907a4f4c565cfdc55a9ce148a761a11d5", + "version": "0.16.3" + }, + "name": "sourceControlCheckout" + }, + "subpath": "Path.swift" + }, + { + "basedOn": null, + "packageRef": { + "identity": "promisekit", + "kind": "remoteSourceControl", + "location": "https://github.com/mxcl/PromiseKit.git", + "name": "PromiseKit" + }, + "state": { + "checkoutState": { + "revision": "1c296a8637838901d2b01e4c46875ee749506133", + "version": "6.8.5" + }, + "name": "sourceControlCheckout" + }, + "subpath": "PromiseKit" + }, + { + "basedOn": null, + "packageRef": { + "identity": "rainbow", + "kind": "remoteSourceControl", + "location": "https://github.com/onevcat/Rainbow.git", + "name": "Rainbow" + }, + "state": { + "checkoutState": { + "revision": "626c3d4b6b55354b4af3aa309f998fae9b31a3d9", + "version": "3.2.0" + }, + "name": "sourceControlCheckout" + }, + "subpath": "Rainbow" + }, + { + "basedOn": null, + "packageRef": { + "identity": "swift-argument-parser", + "kind": "remoteSourceControl", + "location": "https://github.com/apple/swift-argument-parser", + "name": "swift-argument-parser" + }, + "state": { + "checkoutState": { + "revision": "9f39744e025c7d377987f30b03770805dcb0bcd1", + "version": "1.1.4" + }, + "name": "sourceControlCheckout" + }, + "subpath": "swift-argument-parser" + }, + { + "basedOn": null, + "packageRef": { + "identity": "swiftsoup", + "kind": "remoteSourceControl", + "location": "https://github.com/scinfu/SwiftSoup.git", + "name": "SwiftSoup" + }, + "state": { + "checkoutState": { + "revision": "aeb5b4249c273d1783a5299e05be1b26e061ea81", + "version": "2.0.0" + }, + "name": "sourceControlCheckout" + }, + "subpath": "SwiftSoup" + }, + { + "basedOn": null, + "packageRef": { + "identity": "version", + "kind": "remoteSourceControl", + "location": "https://github.com/mxcl/Version.git", + "name": "Version" + }, + "state": { + "checkoutState": { + "revision": "087c91fedc110f9f833b14ef4c32745dabca8913", + "version": "1.0.3" + }, + "name": "sourceControlCheckout" + }, + "subpath": "Version" + }, + { + "basedOn": null, + "packageRef": { + "identity": "yams", + "kind": "remoteSourceControl", + "location": "https://github.com/jpsim/Yams", + "name": "Yams" + }, + "state": { + "checkoutState": { + "revision": "01835dc202670b5bb90d07f3eae41867e9ed29f6", + "version": "5.0.1" + }, + "name": "sourceControlCheckout" + }, + "subpath": "Yams" + } + ] + }, + "version": 6 +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 056bada2b343..c5abaa70bc18 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4189,7 +4189,10 @@ with pkgs; xcodeenv = callPackage ../development/mobile/xcodeenv { }; - xcodes = callPackage ../development/tools/xcodes { }; + xcodes = swiftPackages.callPackage ../development/tools/xcodes { + inherit (swiftPackages.apple_sdk.frameworks) CryptoKit LocalAuthentication; + inherit (swiftPackages.apple_sdk) libcompression; + }; gomobile = callPackage ../development/mobile/gomobile { };