Skip to content

Commit

Permalink
default-crate-overrides.nix: prevent git fetch
Browse files Browse the repository at this point in the history
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`):

  NixOS#224893 (review)

Tested on:
- [x] `aarch64-linux` (cross from `x86_64-linux`)
  • Loading branch information
Adam Joseph authored and jackyliu16 committed Apr 22, 2023
1 parent 40b5e10 commit 895b556
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkgs/build-support/rust/default-crate-overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
, alsa-lib
, graphene
, protobuf
, autoconf
, automake
, libtool
, ...
}:

Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 895b556

Please sign in to comment.