From 482b61e1423f264279bb321b8d8c93fb766d4927 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Wed, 5 Apr 2023 01:27:38 -0700 Subject: [PATCH] default-crate-overrides.nix: prevent `git fetch` The build.rs script shipped with evdev-sys attempts to detect cross compilation and uses a completely different codepath which does a `git fetch` inside the build script. This doesn't work in nixpkgs. This PR adds a `touch libevdev/.git` to trick the `build.rs` into thinking that it is not necessary to do a `git fetch`. Thanks to @figsoda for finding this more-elegant solution to the problem (my original solution needed to patch `build.rs`): https://github.com/NixOS/nixpkgs/pull/224893#pullrequestreview-1373809617 Tested on: - [x] `aarch64-linux` (cross from `x86_64-linux`) --- pkgs/build-support/rust/default-crate-overrides.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/rust/default-crate-overrides.nix b/pkgs/build-support/rust/default-crate-overrides.nix index 441c6dfaf9c3..a0e3c8fabea0 100644 --- a/pkgs/build-support/rust/default-crate-overrides.nix +++ b/pkgs/build-support/rust/default-crate-overrides.nix @@ -36,6 +36,9 @@ , alsa-lib , graphene , protobuf +, autoconf +, automake +, libtool , ... }: @@ -85,8 +88,16 @@ in }; evdev-sys = attrs: { - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = + [ pkg-config + python3 autoconf automake libtool # used only if HOST!=TARGET + ]; buildInputs = [ libevdev ]; + + # This prevents libevdev's build.rs from trying to `git fetch` when HOST!=TARGET + prePatch = '' + touch libevdev/.git + ''; }; expat-sys = attrs: {