Commit Graph

530 Commits

Author SHA1 Message Date
Ryan Lahfa
b10994c38c
Merge pull request #220429 from amjoseph-nixpkgs/pr/build-rust-crate/cross/linker 2023-10-31 12:12:17 +01:00
Adam Joseph
4fc0e33698 buildRustPackage: add isMips64n32 to badPlatforms
Rust is not yet able to target the n32 ABI on mips64.

Let's add `isMips64n32` to the `meta.badPlatforms` of all
derivations created by buildRustPackage.

I use this to automatically detect which packages on my system can
be built for n32 (almost all of them) and build those using n32, and
the few packages (mainly those that depend on boost or rust) that
can't for n64.
2023-10-23 08:38:25 +00:00
Adam Joseph
3bd3809d0e buildRustCrate: add isMips64n32 to badPlatforms
Rust is not yet able to target the n32 ABI on mips64.

Let's add `isMips64n32` to the `meta.badPlatforms` of all
derivations created by buildRustCrate.

I use this to automatically detect which packages on my system can
be built for n32 (almost all of them) and build those using n32, and
the few packages (mainly those that depend on boost or rust) that
can't for n64.
2023-10-23 08:38:25 +00:00
Alyssa Ross
7262026f0f
rustPlatform.cargoSetupHook: fix platform check (#260068)
Cargo will never need to link for the target platform — that'd be for
the package being built to do at runtime.  Cargo should know about the
build and host linkers.

This fixes e.g. pkgsCross.musl64.fd from x86_64-linux.

Fixes: 67a4f828b4 ("rust: hooks: fix cross compilation")
2023-10-11 23:36:56 +02:00
Fabián Heredia Montiel
2f0e87732c Merge remote-tracking branch 'origin/master' into staging-next 2023-10-08 10:14:51 -06:00
Alyssa Ross
1cbe5c3e8b rust.toRustTargetForUseInEnvVars: support custom targets
> If using a target spec JSON file, the <triple> value is the filename
> stem. For example --target foo/bar.json would match [target.bar].

- https://doc.rust-lang.org/cargo/reference/config.html#target

I've also exposed toRustTargetSpecShort as a public function, because
it's useful to be able to know what the target subdirectory will be.
2023-10-03 12:30:04 +00:00
figsoda
14d44173e4
Merge pull request #256949 from andresilva/build-rust-package-profiles
buildRustPackage: support custom cargo profiles
2023-09-29 15:54:49 -04:00
Adam Joseph
67a4f828b4 rust: hooks: fix cross compilation
Currently there is a state of severe confusion in
pkgs/build-support/rust/hooks/ regarding host vs target; right now
there is only "host" defined, but whether it means "host" or
"target" seems to fluctuate.

This commit corrects that, ensuring that all variables come in all
three flavors (build, host, target) and are used consistently with
the nixpkgs convention.

This also fixes the cross-compilation of packages which use
`maturinBuildHook` -- hooks go in `nativeBuildInputs` and are
phase-shifted backwards by one platform, so they need to be careful
about distinguishing between build and host.

Closes #247441
2023-09-26 06:30:44 +00:00
Adam Joseph
c1df604e9f rust: add rust.envVars 2023-09-26 06:30:44 +00:00
André Silva
8674922276
buildRustPackage: support custom cargo profiles 2023-09-24 18:40:24 +01:00
Bouke van der Bijl
352ff3f226
Update pkgs/build-support/rust/build-rust-crate/default.nix
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2023-09-23 10:19:03 +02:00
Bouke van der Bijl
4270524d3f build-rust-crate: add stripExclude for .rlib 2023-09-18 16:03:04 +02:00
Adam Joseph
2ea678ed48 default-crate-overrides: add libseat-sys
This is needed for building `cosmic-comp` using `crate2nix` instead
of `buildRustPackage` (like
https://github.com/NixOS/nixpkgs/pull/251365/ does).
2023-08-26 01:08:29 -07:00
Vladimír Čunát
1c0d654684
Merge #239191: treewide: gobject-introspection from buildInputs to nativeBuildInputs
...into staging
2023-07-26 20:53:32 +02:00
github-actions[bot]
941ae3102b
Merge staging-next into staging 2023-07-22 12:02:07 +00:00
Felix Bühler
0a2745684e
Merge pull request #239624 from Stunkymonkey/use-optionalString-then
treewide: use optionalString instead of 'then ""'
2023-07-22 13:02:47 +02:00
David Arnold
b3d2765271
rustPlatform.maturinBuildHook: fix postBuild hook to use ./dist contract 2023-07-16 16:09:37 -05:00
linsui
e05bacf4e8 importCargoLock: fix git dep config file 2023-06-29 21:47:27 +08:00
Artturin
9999bf7a21 treewide: gobject-introspection from buildInputs to nativeBuildInputs
gobject-introspection should be in nativeBuildInputs for cross to work
properly (so propagations and hook work properly)
2023-06-28 22:33:40 +03:00
github-actions[bot]
2c439c14b6
Merge master into staging-next 2023-06-25 18:01:21 +00:00
Felix Buehler
6672dde558 treewide: use optionalAttrs instead of 'else {}' 2023-06-25 11:01:34 -03:00
Felix Buehler
f3719756b5 treewide: use optionalString instead of 'then ""' 2023-06-24 20:19:19 +02:00
github-actions[bot]
15a20aee5e
Merge staging-next into staging 2023-06-22 18:01:45 +00:00
figsoda
82ee5cb909
Merge pull request #236490 from alyssais/cargo-strip 2023-06-20 20:03:11 -04:00
Alyssa Ross
f5d8384094
rustPlatform.cargoBuildHook: don't let cargo strip
This fixes debug info of cloud-hypervisor, which recently added
strip = true to its release profile in Cargo.toml.
2023-06-20 09:51:42 +00:00
figsoda
67a038cacf tests.importCargoLock.maturin: reexport maturin.tests.pyo3
This allows the Cargo.lock to be removed, since the 2 packages are mostly identical
2023-06-19 10:42:24 -04:00
Guillaume Girol
f8602fa508
Revert "build-rust-{crate,package}: cleanups" 2023-06-18 09:27:44 +00:00
github-actions[bot]
af7beed7be
Merge master into staging-next 2023-06-16 06:01:09 +00:00
figsoda
1cabbd4eec
Merge pull request #237984 from lopsided98/rustc-armv6l 2023-06-15 21:54:03 -04:00
Sandro Jäckel
9a6ee48a3d
build-rust-package: remove unused input 2023-06-15 23:55:35 +02:00
Sandro Jäckel
ddad581c0d
build-rust-crate: cleanup with statix 2023-06-15 23:55:35 +02:00
Ben Wolsieffer
87ebad10d6 rustc: add armv6l-linux to platforms
armv6l-linux was incorrectly added to the list of platforms without host
tools in #227987. arm-unknown-linux-gnueabihf is present in the list of
Tier 2 targets with host tools, and this target corresponds to our
armv6l-linux platform.
2023-06-15 16:56:55 -04:00
github-actions[bot]
9f2767ce37
Merge staging-next into staging 2023-06-10 18:01:41 +00:00
Daniel Nagy
ca2cb9f644 treewide: "libary" -> "library" 2023-06-10 14:54:08 +01:00
figsoda
f4a6750079 rustPlatform.fetchCargoTarball: remove explicit sparse protocol
sparse protocol is now the default since rust 1.70
2023-06-02 21:28:57 -04:00
figsoda
d456b861b8 fetchCrate: fix registryDl
follow up to #234066, since I made a mistake
2023-05-28 13:20:03 -04:00
figsoda
545206f936 fetchCrate: allow overriding registryDl
This will allow `rustPlatform.importCargoLock` to use `fetchCrate`
directly instead of including its own implementation.
2023-05-25 16:29:01 -04:00
figsoda
9a7fd959fa
Merge pull request #228928 from DeeUnderscore/fix/replace-workspace-values-bool 2023-05-18 14:54:12 -04:00
Alyssa Ross
376ba26812 buildRustPackage: disable auditing if it's broken
See also: ad3a532658 ("rust/cargo.nix: disable audit if audit.meta.broken")

Fixes cross eval of clippy.
2023-05-09 23:46:55 -04:00
D Anzorge
38fb742663 rustPlatform.importCargoLock: fix [package] section handling
Members of the [package] table in Cargo.toml can be either subtables, or
values like strings and bools. Python is happy to check for membership
of "workspace" in a string, since Python strings are iterables, but if
the value is a bool, Python will throw an exception.
2023-04-29 21:05:05 +02:00
Alyssa Ross
57e73d23bb rustc,rustPlatform.buildRustPackage: broaden platforms
rustc supports way more platforms than Linux and Darwin.  We might not
be able to build it for every platform at the moment, but that's what
meta.broken is for.

There are other platforms that rustc can produce binaries for, but
can't run on itself, so those are listed in the defaults for
buildRustPackage.
2023-04-25 08:27:59 +00:00
Alyssa Ross
90a8b9e3fe rustPlatform.buildRustPackage: fix cross
.override breaks splicing, so this was using the shell for the host
platform.
2023-04-24 19:43:39 +00:00
Artturi
5fd9ce4fa7
Merge pull request #190610 from amjoseph-nixpkgs/pr/build-rust-crate/gdk3 2023-04-22 15:45:56 +03:00
Adam Joseph
42c8e4dd18 build-rust-crate: dontStrip=!release
Without this PR, unlike `RUST_LIB_BACKTRACE=1 cargo run` you won't
get line numbers in backtraces from binaries built with:

```
nix build -f Cargo.nix --arg release false
```

This PR fixes that.
2023-04-12 15:24:50 -04:00
github-actions[bot]
fc0616b73d
Merge master into staging-next 2023-04-09 06:01:16 +00:00
Adam Joseph
579b812b0e https://github.com/NixOS/nixpkgs/pull/224893#pullrequestreview-1375521876 2023-04-06 13:43:22 -07:00
Adam Joseph
482b61e142 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`)
2023-04-06 13:05:07 -07:00
github-actions[bot]
6e7ab02752
Merge master into staging-next 2023-04-06 06:01:26 +00:00
Adam Joseph
476fde08af default-crate-overrides.nix: prost-build needs protobuf 2023-04-05 15:40:17 -07:00
figsoda
201d4b7c5c rustPlatform.buildRustPackage: make auditable the default 2023-03-26 22:47:06 -04:00