Commit Graph

347 Commits

Author SHA1 Message Date
Faye Duxovni
bc5e8ae506 buildRustCrate: don't try to set CARGO_FEATURE_ variables for dep: features
These features are internal-only, have special characters that bash
doesn't support in variable names, and aren't normally given
environment variables by cargo as far as I can tell.
2022-04-16 06:53:45 -04:00
sohalt
3619ffaeb6 rust: fix importCargoLock for repositories without toplevel Cargo.toml
Some crates do not have a Cargo.toml at the top-level, but only in
nested directories. Before this change importCargoLock used to fail with:

error: manifest path `/nix/store/some-store-path/Cargo.toml` does not exist
2022-03-17 00:15:56 -04:00
Guillaume Girol
bedabfbcef rustPlatform.bindgenHook: init 2022-02-22 19:37:07 +01:00
github-actions[bot]
b74b591fbe
Merge master into staging-next 2022-01-20 00:01:46 +00:00
Andreas Rammhold
31e5b8dc21
Remove myself from maintainers
I don't have time and energy to deal with all of this anymore.
2022-01-20 00:24:52 +01:00
K900
deb7e771aa rust/hooks: ensure the build output ends up in the right place
Otherwise cargoInstallHook can fail to find and actually install it.
2021-12-26 11:04:07 +03:00
John Ericson
f721e0f849
Merge pull request #145107 from Ericson2314/buildRustCrate-sysroot
build-support/rust: Fix sysroot for cross
2021-11-24 18:44:13 -05:00
Andreas Rammhold
48de1b8ed8
Merge pull request #142699 from steveeJ-forks/fix-import-cargo-lock
rust: find nested packages in git repositories
2021-11-17 13:31:57 +01:00
John Ericson
05efb8ed91 build-support/rust/sysroot/src: Use dont* instead of phase list
Making this separate commit because the original was moved out just the
way it was done before.
2021-11-08 21:38:58 +00:00
John Ericson
c9c3de0131 Update script as rust-src layout has changed
Use stub lib so `core` and `alloc` are handled symmetrically.
2021-11-08 20:38:59 +00:00
John Ericson
cbd00bab80 build-support/rust: Split out sysroot src derivation
Hoping to make it usable for `buildRustCrate` too.
2021-11-08 20:38:59 +00:00
John Ericson
4f81865aa1 Merge remote-tracking branch 'upstream/master' into staging-next 2021-11-07 20:51:04 +00:00
John Ericson
18ed048c7b build-support/rust: Organize
- `toRustTarget` and friends pulled out from rust tools into rust
   library. Since they don't depend on any packages they can be more
   widely useable.

 - `build-rust-package` gets its own directory

 - `fetch-cargo-tarball` gets its own directory
2021-11-07 14:16:49 -05:00
Alyssa Ross
3f01b576af
Merge remote-tracking branch 'nixpkgs/staging-next' into staging
Conflicts:
	nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
	nixos/doc/manual/release-notes/rl-2111.section.md
2021-10-28 16:07:38 +00:00
github-actions[bot]
a1e570b43e
Merge master into staging-next 2021-10-28 00:01:36 +00:00
Kerstin Humm
5df2d4d345
default-crate-overrides: remove two crates that are probably irrelevant 2021-10-27 22:29:10 +02:00
Kerstin Humm
f1bacf5b07 default-crate-overrides: expat-sys, glib-sys, libudev-sys, sdl2-sys, servo-fontconfig, skia-bindings 2021-10-28 03:07:33 +09:00
figsoda
5a08a28803 rustPlatform: add support for features 2021-10-27 08:08:03 -04:00
Stefan Junker
445510ed69 rust/import-cargo-lock: hopefully make nested crate test work on macos 2021-10-25 01:11:45 +02:00
Stefan Junker
f9a340a916 rust/import-cargo-lock: add test git-dependency-rev-non-workspace-nested-crate 2021-10-24 20:27:42 +02:00
Stefan Junker
b2aa19efe7 rust: find nested packages in git repositories
this mimics the heuristic cargo uses for finding crates in their git
repositories ([cargo-issue-1462]).

[cargo-issue-1462]: https://github.com/rust-lang/cargo/issues/1462
2021-10-24 01:52:44 +02:00
github-actions[bot]
2d8f645c79
Merge master into staging-next 2021-10-20 06:01:15 +00:00
figsoda
f441e6b7f4 buildRustPackage,fetchCargoTarball: accept empty hashes 2021-10-19 20:56:46 -04:00
figsoda
836e6d3e02 buildRustPackage: remove unused arguments, minor styling changes 2021-10-19 20:11:28 -04:00
figsoda
d81f8fa0a4
Merge pull request #138822 from figsoda/fix-cargo-check-type
[staging] rustPlatform.cargoCheckHook: respect cargoCheckType
2021-10-11 15:54:00 -04:00
John Ericson
811f849961 buildRustCrate: Don't override the linker during cross
lld is sometimes need. The caller can do that instead.
2021-10-06 16:59:53 -04:00
John Ericson
4430761186 buildRustCrate: Add extraRustcOptsForBuild
`extraRustcOpts` should not be used for build.rs, lest it contain
host-platform-specific options during cross builds.
2021-10-06 16:59:52 -04:00
John Ericson
0ee5640d78 buildRustCrate: Fix extra cross args
Do proper list separation, use ld not cc because rustc doesn't `-Wl,`.
2021-10-06 16:59:19 -04:00
figsoda
22efdc986c rustPlatform.cargoCheckHook: respect cargoCheckType 2021-09-21 13:00:25 -04:00
Bruno Bigras
c426b46aee defaultCrateOverrides: add rdkafka-sys 2021-09-21 12:07:25 -04:00
Daniël de Kok
24b5074348
Merge pull request #137395 from dermetfan/cargo-lock-restricted
importCargoLock: introduce alternative parameter `lockFileContents`
2021-09-20 18:05:08 +02:00
Robin Stumm
d3018c4522 importCargoLock: introduce alternative parameter lockFileContents
In restricted mode (and therefore with flakes) `builtins.readFile` may not be the result of `builtins.toFile`,
making it impossible to use a generated lockFile (with or without IFD),
and thereby causing evaluation to fail if `system != builtins.currentSystem` on Hydra
so the jobs are not delegated to eligible build machines that support that system.

This is done in a way that avoids rebuilds.
2021-09-20 14:54:40 +02:00
Daniël de Kok
6f2ce2a65e treewide: remove danieldk as maintainer from a set of packages
I currently do not have much time to work on nixpkgs. Remove
myself as a maintainer from a bunch of packages to avoid that
people are waiting on me for a review.
2021-09-12 14:42:12 +00:00
Sandro
bcced5deff
Merge pull request #137204 from SuperSandro2000/fetchCargoTarball
rust.fetchCargoTarball: remove phases
2021-09-11 19:31:03 +02:00
Jörg Thalheim
f21712edaa importCargoLock: add docs how to run these tests 2021-09-11 11:14:58 +02:00
Yureka
34cc1821db
importCargoLock: add tests for branch and tag 2021-09-11 09:19:18 +02:00
Yureka
00b1ac5b23 importCargoLock: git deps with rev, branch or tag
Previously importCargoLog only recognized git dependencies with `rev =`.
This adds support for git dependencies with `branch =` or `tag =`.
2021-09-10 23:00:46 +02:00
Sandro Jäckel
012685943f
rust.fetchCargoTarball: remove phases 2021-09-09 19:17:48 +02:00
happysalada
c9f0c6f115 build-rust-crate: add global libiconv darwin buildInputs 2021-09-04 12:03:36 +09:00
happysalada
0585c981f1 build-rust-crate: nixpkgs-fmt 2021-09-04 12:03:36 +09:00
happysalada
0e8d59e3cb default-crate-overrides: nixpkgs-fmt 2021-09-04 12:03:36 +09:00
Robin Stumm
3bdfca4491 buildRustPackage: remove unused parameter 2021-08-20 12:46:05 +02:00
Robert Hensing
a13aa64bd3 build-support/rust: remove unused runCommandNoCC 2021-08-15 17:36:41 +02:00
tekeri
2419ea4aff rust: fix build of pam-sys package 2021-08-15 15:55:20 +09:00
Romanos Skiadas
23dd37dd5e rustPlatform.importCargoLock: add an assert for old Cargo.locks
near the end of 2019, the default Cargo.lock format was changed to
[[package]]
checksum = ...

This is what importCargoLock assumes. If the crate had not been `cargo
update`'d with a more recent toolchain than the one with the new
format as default, importCargoLock would fail when trying to access
pkg.checksum.

I ran into such a case (shamefully, in my own crate) and it took me a
while to figure out what was going on, so here is an assert with a
more user friendly message and a hint.
2021-07-18 18:19:50 +03:00
pandaman64
c39040195f build-rust-crate: disable incremental builds
According to rustc implementation[1], `-C incremental=no` enables
incremental builds with directory name `no`. This patch removes the
`-C incremental` argument to disable incremental builds.

[1]: ee86f96ba1/compiler/rustc_session/src/options.rs (L918-L919)
2021-07-09 22:55:38 +09:00
Daniël de Kok
1da0b1dbc9
Merge pull request #122158 from danieldk/import-cargo-lock
rustPlatform.buildRustPackage: support direct use of Cargo.lock
2021-05-28 12:07:25 +02:00
Daniël de Kok
d3769e43c3 rustPlatform.importCargoLock: add test cases for importCargoLock 2021-05-28 08:01:28 +02:00
Daniël de Kok
b3969f3ad7 rustPlatform.buildRustPackage: support direct use of Cargo.lock
This change introduces the cargoLock argument to buildRustPackage,
which can be used in place of cargo{Sha256,Hash} or cargoVendorDir. It
uses the importCargoLock function to build the vendor
directory. Differences compared to cargo{Sha256,Hash}:

- Requires a Cargo.lock file.
- Does not require a Cargo hash.
- Retrieves all dependencies as fixed-output derivations.

This makes buildRustPackage much easier to use as part of a Rust
project, since it does not require updating cargo{Sha256,Hash} for
every change to the lock file.
2021-05-28 08:01:28 +02:00
Daniël de Kok
2f46d77e28 rustPlatform.importCargoLock: init
This function can be used to create an output path that is a cargo
vendor directory. In contrast to e.g. fetchCargoTarball all the
dependent crates are fetched using fixed-output derivations. The
hashes for the fixed-output derivations are gathered from the
Cargo.lock file.

Usage is very simple, e.g.:

importCargoLock {
  lockFile = ./Cargo.lock;
}

would use the lockfile from the current directory.

The implementation of this function is based on Eelco Dolstra's
import-cargo:

https://github.com/edolstra/import-cargo/blob/master/flake.nix

Compared to upstream:

- We use fetchgit in place of builtins.fetchGit.
- Sync to current cargo vendoring.
2021-05-28 08:01:25 +02:00