From e3e4dbd72eb56cefa8e6938a4e7201bc77edb16e Mon Sep 17 00:00:00 2001 From: figsoda Date: Tue, 18 Oct 2022 20:06:02 -0400 Subject: [PATCH] cargo-ui: unbreak on darwin --- .../tools/rust/cargo-ui/default.nix | 26 +++-- .../tools/rust/cargo-ui/update-git2.patch | 94 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +- 3 files changed, 115 insertions(+), 9 deletions(-) create mode 100644 pkgs/development/tools/rust/cargo-ui/update-git2.patch diff --git a/pkgs/development/tools/rust/cargo-ui/default.nix b/pkgs/development/tools/rust/cargo-ui/default.nix index da5137154bb..1eac0e90577 100644 --- a/pkgs/development/tools/rust/cargo-ui/default.nix +++ b/pkgs/development/tools/rust/cargo-ui/default.nix @@ -1,14 +1,16 @@ { lib , rustPlatform , fetchCrate -, cmake , pkg-config , makeWrapper +, libgit2 , openssl , stdenv +, expat , fontconfig , libGL , xorg +, darwin }: rustPlatform.buildRustPackage rec { @@ -20,13 +22,23 @@ rustPlatform.buildRustPackage rec { sha256 = "sha256-IL7BxiJg6eTuFM0pJ3qLxYCVofE/RjmgQjvOW96QF9A="; }; - cargoSha256 = "sha256-16mgp7GsjbizzCWN3MDpl6ps9CK1zdIpLiyNiKYjDI4="; + # update dependencies so it is compatible with libgit2 1.5 + # libgit2-sys 0.14.3 is only compatible with libgit2 1.4 + cargoPatches = [ ./update-git2.patch ]; - nativeBuildInputs = [ cmake pkg-config ] ++ lib.optionals stdenv.isLinux [ + cargoSha256 = "sha256-i/ERVPzAWtN4884051VoA/ItypyURpHb/Py6w3KDOAo="; + + nativeBuildInputs = [ + pkg-config + ] ++ lib.optionals stdenv.isLinux [ makeWrapper ]; - buildInputs = [ openssl ] ++ lib.optionals stdenv.isLinux [ + buildInputs = [ + libgit2 + openssl + ] ++ lib.optionals stdenv.isLinux [ + expat fontconfig libGL xorg.libX11 @@ -34,6 +46,10 @@ rustPlatform.buildRustPackage rec { xorg.libXi xorg.libXrandr xorg.libxcb + ] ++ lib.optionals stdenv.isDarwin [ + # dark-light doesn't build on apple sdk < 10.14 + # see https://github.com/frewsxcv/rust-dark-light/issues/14 + darwin.apple_sdk_11_0.frameworks.AppKit ]; postInstall = lib.optionalString stdenv.isLinux '' @@ -47,7 +63,5 @@ rustPlatform.buildRustPackage rec { changelog = "https://github.com/slint-ui/cargo-ui/blob/v${version}/CHANGELOG.md"; license = with licenses; [ mit asl20 gpl3Only ]; maintainers = with maintainers; [ figsoda ]; - # figsoda: I can't figure how to make it build on darwin - broken = stdenv.isDarwin; }; } diff --git a/pkgs/development/tools/rust/cargo-ui/update-git2.patch b/pkgs/development/tools/rust/cargo-ui/update-git2.patch new file mode 100644 index 00000000000..4636a7e42c1 --- /dev/null +++ b/pkgs/development/tools/rust/cargo-ui/update-git2.patch @@ -0,0 +1,94 @@ +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -720,9 +720,9 @@ dependencies = [ + + [[package]] + name = "crates-index" +-version = "0.18.7" ++version = "0.18.10" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "0044896374c388ccbf1497dad6384bf6111dbcad9d7069506df7450ce9b62ea3" ++checksum = "3447ec855b0c44cad8eedb3d32b53837f233894d5f4584a2648a7ebc5d3feef4" + dependencies = [ + "git2", + "hex", +@@ -1387,9 +1387,9 @@ dependencies = [ + + [[package]] + name = "git2" +-version = "0.14.3" ++version = "0.15.0" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "5e77a14ffc6ba4ad5188d6cf428894c4fcfda725326b37558f35bb677e712cec" ++checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1" + dependencies = [ + "bitflags", + "libc", +@@ -1884,9 +1884,9 @@ checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" + + [[package]] + name = "libgit2-sys" +-version = "0.13.3+1.4.2" ++version = "0.14.0+1.5.0" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "c24d36c3ac9b9996a2418d6bf428cc0bc5d1a814a84303fc60986088c5ed60de" ++checksum = "47a00859c70c8a4f7218e6d1cc32875c4b55f6799445b842b0d8ed5e4c3d959b" + dependencies = [ + "cc", + "libc", +@@ -2712,9 +2712,9 @@ dependencies = [ + + [[package]] + name = "rayon" +-version = "1.5.2" ++version = "1.5.3" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "fd249e82c21598a9a426a4e00dd7adc1d640b22445ec8545feef801d1a74c221" ++checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" + dependencies = [ + "autocfg", + "crossbeam-deque", +diff --git a/Cargo.toml b/Cargo.toml +index ca5269d..6fa4ec2 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -33,7 +33,7 @@ version = "1.0.53" + version = "0.14" + + [dependencies.crates-index] +-version = "0.18.0" ++version = "0.18.10" + + [dependencies.dunce] + version = "1.0.2" +@@ -42,7 +42,7 @@ version = "1.0.2" + version = "0.3" + + [dependencies.git2] +-version = "0.14.3" ++version = "0.15.0" + + [dependencies.itertools] + version = "0.10" +diff --git a/Cargo.toml.orig b/Cargo.toml.orig +index 52eadbd..ef8aa7c 100644 +--- a/Cargo.toml.orig ++++ b/Cargo.toml.orig +@@ -22,7 +22,7 @@ default = ["slint-backend-qt", "slint-backend-gl-all"] + [dependencies] + anyhow = "1.0.53" + cargo_metadata = "0.14" +-crates-index = { version = "0.18.0" } ++crates-index = { version = "0.18.10" } + dunce = "1.0.2" + futures = "0.3" + itertools = "0.10" +@@ -34,7 +34,7 @@ shlex = "1.1" + slint = { version = "0.2.4", default-features = false, features = [ "compat-0-2-0" ] } + tokio = { version = "1.16.1", features= ["full"] } + toml_edit = "0.14.3" +-git2 = "0.14.3" ++git2 = "0.15.0" + + [build-dependencies] + slint-build = { version = "0.2.4" } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e457bc19d40..9548f3c39d9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14915,9 +14915,7 @@ with pkgs; cargo-udeps = callPackage ../development/tools/rust/cargo-udeps { inherit (darwin.apple_sdk.frameworks) CoreServices Security SystemConfiguration; }; - cargo-ui = callPackage ../development/tools/rust/cargo-ui { - inherit (darwin.apple_sdk.frameworks); - }; + cargo-ui = darwin.apple_sdk_11_0.callPackage ../development/tools/rust/cargo-ui { }; cargo-tauri = callPackage ../development/tools/rust/cargo-tauri { };