Commit Graph

597 Commits

Author SHA1 Message Date
Aleksana
85bcad4a96
Merge pull request #304583 from rayanpiro/sparse-protocol
rustPlatform.importCargoLock: Adding sparse protocol
2024-08-03 21:23:13 +08:00
Vladimír Čunát
2c053848df
Merge branch 'master' into staging 2024-07-11 22:05:05 +02:00
Florian Klink
9e3825de8d defaultCrateOverrides: add extraLinkFlags to zlib
These libraries need zlib, and otherwise cause a linker error when
linking the final crate of a tauri/wry project.
2024-07-09 18:12:38 +03:00
github-actions[bot]
1f5f0905f8
Merge staging-next into staging 2024-07-06 12:01:49 +00:00
Ilan Joselevich
7220592b15
Merge pull request #324880 from flokli/defaultCreateOverridesFixes
defaultCrateOverrides: fix some gtk dependencies
2024-07-06 13:05:14 +03:00
Martin Weinelt
e7b1ee45cf
Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
- pkgs/tools/misc/watchlog/default.nix
2024-07-06 01:52:35 +02:00
Martin Weinelt
d9610a9f2e
Merge remote-tracking branch 'origin/master' into staging-next 2024-07-06 01:51:14 +02:00
Florian Klink
0c00ad14ac defaultCrateOverrides: fix some gtk dependencies
- gobject-sys and gio-sys need pkg-config
 - add gtkx11-sys
 - add javascriptcore-rs-sys
 - add soup3-sys
 - add webkit2gtk-sys
2024-07-06 00:05:43 +03:00
Florian Klink
cbe5cf5d81 buildRustCrate: don't swallow build.rs output
This is executed curing the build, and usually quite helpful in telling
you how the build failed, if it failed.

For example, when linking against system libraries, it shows which
system lib could not be discovered, the pkg-config path used etc.

Not showing it simply removes all this, and trying to parse out the
"important" bits and only show these is probably also brittle.

The output generally isn't that spammy normally, so let's just `tee` it.
2024-07-05 21:39:08 +03:00
aleksana
07fddc62e4 buildRustPackage: deprecate cargoSha256 in favor of cargoHash 2024-07-03 21:54:26 +08:00
aleksana
a9709c299b treewide: change cargoSha256 with SRI hash to cargoHash 2024-07-03 21:53:11 +08:00
K900
665f1d6183 Merge remote-tracking branch 'origin/master' into staging-next 2024-07-02 08:32:46 +03:00
Ilan Joselevich
b870209e42
Merge pull request #323110 from thehabbos007/cargo-cdylib
buildRustCrate: add support for `cargo::rustc-cdylib-link-arg`
2024-07-01 21:09:25 +03:00
Ahmad Sattar
1cf6e5eaa1 buildRustCrate: add support for cargo::rustc-cdylib-link-arg 2024-07-01 09:29:46 +02:00
Martin Weinelt
9b79a05ae1
Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
- pkgs/development/python-modules/flexcache/default.nix
- pkgs/development/python-modules/flexparser/default.nix
- pkgs/development/python-modules/odp-amsterdam/default.nix
- pkgs/development/python-modules/pint/default.nix
- pkgs/development/python-modules/uncertainties/default.nix
- pkgs/top-level/python-packages.nix
2024-07-01 01:07:21 +02:00
Florian Klink
641b2f29b6
Merge pull request #319153 from Kranzes/buildRustCrate-wasm
buildRustCrate: add support for compiling to wasm32-unknown-unknown
2024-06-30 14:05:33 +03:00
Ilan Joselevich
cc379b60f0
tests.buildRustCrate: add crateLibOutputsWasm32
Added a cross compilation test for wasm32-unknown-unknown. This also
required using crate.metadata instead of using the regex to get rid of
the hash in the library filename. It also required adding a mkCrate
argument to assertOutputs so we can override the buildRustCrate used.
2024-06-24 21:13:50 +03:00
Ilan Joselevich
cf5e2c2c9a
buildRustCrate: support cross compiling to wasm32-unknown-unknown
With this change you will finally be able to use
buildRustCrate/crate2nix to build your wasm32-unknown-unknown
rust projects.

Simply import nixpkgs like so:
```
lib = <nixpkgs/lib>;
pkgsForWasm32 = import <nixpkgs> {
  crossSystem = lib.examples.wasm32-unknown-none;
}
```
or use pkgsCross directly with
```
pkgsCross.wasm32-unknown-none.callPackage ./. { };
```
2024-06-24 19:28:33 +03:00
Winter
2de1fd60fc
Revert "rust: Write config.toml not config" 2024-06-23 12:32:29 -04:00
Pol Dellaiera
a2b5266973
Merge pull request #321095 from mmlb/rust-write-config.toml-not-config
rust: Write config.toml not config
2024-06-21 22:32:49 +02:00
github-actions[bot]
fb94da4e9e
Merge staging-next into staging 2024-06-21 18:01:30 +00:00
Ilan Joselevich
b561a29e4d
defaultCrateOverrides: add missing protobuf to crates 2024-06-21 18:21:39 +03:00
github-actions[bot]
c6707a9686
Merge staging-next into staging 2024-06-21 12:01:53 +00:00
Ilan Joselevich
d9e5089751
Merge pull request #321220 from thehabbos007/cargo-colon
buildRustCrate: support new cargo invocation syntax for build script outputs
2024-06-21 14:21:47 +03:00
Ahmad Sattar
95bb410817 buildRustCrate: support cargo:: invocation syntax for build script outputs
In order to allow for the new `cargo::` prefix for build script outputs
we have to adjust the configure-crate bash scripts in buildRustCrate to
properly parse the new additional syntax.

These changes don't affect existing build scripts configured with the
old `cargo:` prefix.

For more information, see https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script
2024-06-21 08:29:24 +02:00
Ahmad Sattar
fb927d5019
BuildRustCrate: proc macros must be built for build's platform
When cross compiling proc macros, the proc macro needs to be built for the
build platform's architecture.

Without this change cross compiling from Darwin to Linux would simply
fail because it tries to link to a library with a file extension that
doesn't exist on the builder's platform.
2024-06-20 14:35:49 +03:00
Manuel Mendez
3f7663c1d7 rust: Write to .cargo/config.toml instead of .cargo/config
Seeing the following new warnings pop up on stderr when cargo was bumped
to 1.78:

```
warning: `/build/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
```

which happens to break commitmsgfmt builds in nix (#320294).

closes #320294
2024-06-19 14:56:51 -04:00
Martin Weinelt
f822b2ba5c Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
- pkgs/development/python-modules/langsmith/default.nix
- pkgs/development/python-modules/rich-pixels/default.nix
- pkgs/servers/teleport/generic.nix
2024-06-18 20:16:19 +02:00
Ahmad Sattar
c730e033ca build-rust-crate: quote build script output env var 2024-06-14 10:23:28 +02:00
Dmitry Kalinkin
fbd21c5067
rustPlatform.maturinBuildHook: specify the output directory (#291025) 2024-06-13 19:21:52 -04:00
github-actions[bot]
14aa6e8765
Merge master into staging-next 2024-06-11 12:01:16 +00:00
Ilan Joselevich
de9a49c390 buildRustCrate: extensions.sharedLibrary -> extensions.library
Switched to a common attribute for library file extensions:
de70971c90

This makes buildRustCrate evaluate successfully when using
pkgsCross/pkgsStatic.
2024-06-11 11:27:17 +01:00
Alyssa Ross
4816a73bb5 rustPlatform: --frozen -> --offline
--frozen is stricter than we need in Nixpkgs.  If a Cargo.lock is
slightly wrong, or (in my use case) if building a subproject that is
not a member of the top-level workspace, but the correct Cargo.lock
can be entirely resolved from the existing top-level Cargo.lock, it
should be deterministic, and shouldn't cause any problems, to let
cargo generate the new Cargo.lock.  This should result in less need to
bother upstreams about fixing their Cargo.lock files in cases where
they could have been automatically fixed.
2024-05-18 11:18:59 +02:00
K900
f80228a805 build-support/rust: rewrite workspace dependency inheritance
This fixes at least one bug with default-features, and also
just aligns us more with what Cargo actually does.

Also some Python style fixes and a bit less mutating state.
2024-05-10 20:55:39 +03:00
Alyssa Ross
6d4a14504e
buildRustPackage: add new supported platforms
The new NetBSD platforms have appeared since last time I updated this
list, but it looks like I just missed the MIPS linux ones last time.
2024-05-10 10:18:20 +02:00
Ruben Sanchez Diez
e6dc0fb1a1 rustPlatform.importCargoLock: Adding sparse protocol
When added the new sparse protocol the derivation is not handling properly Cargo.lock with sparse+ registries
2024-04-17 15:42:49 +02:00
lassulus
55205ec1a1
Merge pull request #302926 from helsinki-systems/fix/buildrustpackage-structuredattrs
cargoBuildHook: Fix features with __structuredAttrs
2024-04-16 23:10:26 +02:00
Olivia Crain
1348195416
tests.importCargoLock: fix self-inclusive src listings in .nix files
Replace `src = ./.` instances with more explicit source listings.
Otherwise, derivations will be rebuilt on any change to the files
defining them (e.g. formatting via nixfmt-rfc-style).
2024-04-10 10:27:12 -05:00
Janne Heß
6486868c28
cargoBuildHook: Fix features with __structuredAttrs 2024-04-10 09:24:17 +02:00
Alyssa Ross
6f8fa05acf
wrapRustc: wrap rustdoc
We need to set -crt-static on musl for rustdoc as well, so let's unify
the wrappers.  Ideally, rather than wrapping rustdoc, we'd have
rustdoc use the wrapped rustc, but that's currently only possible with
an unstable option (--test-builder).

The options set by the wrapper, -C target-feature and --sysroot, are
supported by both rustdoc and rustc, but other flags maybe not be
supported by both, so I've introduced different environment
variables (the existing NIX_RUSTFLAGS and a new NIX_RUSTDOCFLAGS) to
allow those to be set independently.

This fixes cargo-auditable in pkgsMusl., which broke because its
doctests stopped working when -crt-static was moved to the wrapper.

Fixes: 79156bf13a ("rustc: move crt-static default override to wrapper (#291829)")
2024-03-02 13:09:07 +01:00
Alyssa Ross
79156bf13a
rustc: move crt-static default override to wrapper (#291829)
Previously, when cross compiling from non-musl to musl, the crt-static
default override wouldn't be applied, because the compiler wouldn't
have been built with it due to fastCross.  Moving it to the wrapper
fixes this without having to introduce extra compiler rebuilds.  And
because the wrapper is applied even to the bootstrap rustc, we no
longer need special handling of crt-static in the Cargo expression.

Unlike --sysroot, rustc allows -C target-feature= to be passed
multiple times, with later instances taking precedence over earlier
ones.  This means that it's very easy to set the default in the
wrapper, just by our overridden default before any other arguments.

This fixes pkgsCross.aarch64-multiplatform-musl.mesa from x86_64-linux.
2024-02-28 23:10:07 +01:00
github-actions[bot]
6a27b0be74
Merge staging-next into staging 2024-01-29 18:01:37 +00:00
Ryan Lahfa
ec84d47ff6
Merge pull request #274440 from bouk/missing-build-rust-env
build-rust-crate: add missing CARGO_PKG env variables
2024-01-29 17:31:54 +01:00
Bouke van der Bijl
34ad6be1cd build-rust-crate: add missing CARGO_PKG env variables
See https://doc.rust-lang.org/cargo/reference/environment-variables.html
for supported variables
2024-01-28 18:59:53 +01:00
Ryan Lahfa
c34dd88211
Merge pull request #284307 from alyssais/rustc-sysroot=
wrapRustc: handle --sysroot=
2024-01-28 00:30:51 +01:00
Alyssa Ross
42b05f1c6d
wrapRustc: handle --sysroot=
This form is used by Linux 6.8.
2024-01-27 19:01:40 +01:00
Alyssa Ross
3bf20e5bf8
rust.envVars: use wrapped LLD for aarch64 musl
The unwrapped version doesn't know where to look for libraries, so
this is required to e.g. build anything that uses openssl-sys with
OPENSSL_NO_VENDOR.  A randomly chosen example package that's fixed by
this change is pkgsStatic.gitoxide.
2024-01-23 17:25:50 +01:00
Alyssa Ross
f3a07da669
rust: use pkgsBuildHost/pkgsTargetTarget
We're already using pkgsBuildBuild, and we'll soon be using
pkgsBuildTarget, so for consistency, change buildPackages and
targetPackages to their corresponding two-component names.
2024-01-23 17:25:23 +01:00
Yureka
0eed8836c5 buildRustPackage: disable cargo-auditable on pkgsStatic aarch64 2024-01-15 22:34:02 +01:00
Yureka
48a6213611 rust: use lld on pkgsStatic aarch64 2024-01-15 22:34:02 +01:00