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`)
This commit is contained in:
Adam Joseph 2023-04-05 01:27:38 -07:00
parent 06c63bcc53
commit 482b61e142

View File

@ -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: {