Commit Graph

352 Commits

Author SHA1 Message Date
sternenseemann
357da6c296 buildRustPackage: make cargoDeps logic easier to follow
The old logic flow had the structure

  if ( … ) {
    if ( … ) {
      …
    } else {
      …
    }
  } else {
    …
  }

which is quite hard to follow in Nix. Instead we ensure that no if
expression is inside a then branch.

This change is zero rebuild, as no logic was changed.
2022-05-13 08:18:39 +10:00
ilkecan
d6bd313f07 buildRustCrate: set meta.mainProgram to crateName 2022-05-05 14:25:27 +00:00
David Scherer
13a9006ec3 Fix determinism by defaulting codegenUnits to 1, not NIX_BUILD_CORES 2022-05-01 11:48:32 -04:00
Mateusz Kowalczyk
f6897d23f4 buildRustCrate: make codegen-units configurable
This parameter is being set to `$NIX_BUILD_CORES` by default. This is a
standard practice but there's a suspicion that this can produce broken
builds. For some details see
https://github.com/cargo2nix/cargo2nix/issues/184 . As a
work-around/test, it'd be good if codegen-units can be set to something
constant, such as `1`. This PR allows it.

Note that the default of `$NIX_BUILD_CORES` is preserved so this MR
causes no change in default behaviour and no rebuilds.
2022-05-01 11:48:32 -04:00
Yusuf Bera Ertan
e2a3a3c690
default-crate-overrides: only add Security to propagatedBuildInputs on darwin for security-framework-sys 2022-04-28 21:24:46 +03:00
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