summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-04-05 01:27:38 -0700
committerAdam Joseph <adam@westernsemico.com>2023-04-06 13:05:07 -0700
commit482b61e1423f264279bb321b8d8c93fb766d4927 (patch)
tree80930ecf6c31cb129f153d5ef6f7563d679f4a0a
parent06c63bcc53f399258dd1a8cc70fa0360447ddc42 (diff)
downloadnixpkgs-482b61e1423f264279bb321b8d8c93fb766d4927.tar
nixpkgs-482b61e1423f264279bb321b8d8c93fb766d4927.tar.gz
nixpkgs-482b61e1423f264279bb321b8d8c93fb766d4927.tar.bz2
nixpkgs-482b61e1423f264279bb321b8d8c93fb766d4927.tar.lz
nixpkgs-482b61e1423f264279bb321b8d8c93fb766d4927.tar.xz
nixpkgs-482b61e1423f264279bb321b8d8c93fb766d4927.tar.zst
nixpkgs-482b61e1423f264279bb321b8d8c93fb766d4927.zip
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`)
-rw-r--r--pkgs/build-support/rust/default-crate-overrides.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/build-support/rust/default-crate-overrides.nix b/pkgs/build-support/rust/default-crate-overrides.nix
index 441c6dfaf9c..a0e3c8fabea 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: {