Commit Graph

523 Commits

Author SHA1 Message Date
Weijia Wang
c1eb661271 Merge branch 'master' into staging-next 2023-11-12 22:13:26 +01:00
Adam Joseph
b6a3fabcc1 rust: allow building/git-bisecting without tarballs
This commit adds the machinery required to get our `rustc.nix` to
work using upstream's git repository, directly, without them waving
dead chickens over it and performing whatever other occult rituals
are involved in creating a release tarball.

No chickens, live or dead, were harmed in the creation of this
commit.
2023-11-11 22:12:40 -08:00
Alyssa Ross
e3e57b8f18 lib.systems: elaborate Rust metadata
We need this stuff to be available in lib so make-derivation.nix can
access it to construct the Meson cross file.

This has a couple of other advantages:

 - It makes Rust less special.  Now figuring out what Rust calls a
   platform is the same as figuring out what Linux or QEMU call it.

 - We can unify the schema used to define Rust targets, and the schema
   used to access those values later.  Just like you can set "config"
   or "system" in a platform definition, and then access those same
   keys on the elaborated platform, you can now set "rustcTarget" in
   your crossSystem, and then access "stdenv.hostPlatform.rustcTarget"
   in your code.

"rustcTarget", "rustcTargetSpec", "cargoShortTarget", and
"cargoEnvVarTarget" have the "rustc" and "cargo" prefixes because
these are not exposed to code by the compiler, and are not
standardized.  The arch/os/etc. variables are all named to match the
forms in the Rust target spec JSON.

The new rust.target-family only takes a list, since we don't need to
worry about backwards compatibility when that name is used.

The old APIs are all still functional with no warning for now, so that
it's possible for external code to use a single API on both 23.05 and
23.11.  We can introduce the warnings once 23.05 is EOL, and make them
hard errors when 23.11 is EOL.
2023-11-09 10:02:24 +01:00
Vladimír Čunát
d811555465
Merge branch 'staging' into staging-next 2023-10-26 10:36:50 +02:00
Robin Gloster
e5d552f5b9
treewide: update globin's maintainership 2023-10-24 13:09:45 +02:00
github-actions[bot]
09fabcdc4e
Merge staging-next into staging 2023-10-22 00:03:08 +00:00
github-actions[bot]
1cf369a0dd
Merge master into staging-next 2023-10-22 00:02:31 +00:00
Auguste Baum
cf9cf45578
rustfmt: add meta.mainProgram 2023-10-21 22:56:17 +02:00
Ryan Lahfa
5829a85d6f
Merge pull request #257950 from RaitoBezarius/rustc-clang 2023-10-12 02:26:16 +02:00
Alyssa Ross
c11cb00a1e rustc: 1.72.1 -> 1.73.0
This upgrade unfortunately removes MIPS support, as it has been
dropped to Tier 3[1] and so bootstrap tarballs are no longer provided.

It looks like it was dropped due to multiple codegen bugs, and lack of
maintenance, so bringing it back would probably involve engaging with
Rust/LLVM upstream on those.

[1]: https://github.com/rust-lang/compiler-team/issues/648
2023-10-10 14:42:30 +00:00
Alyssa Ross
a838aa244f
Merge remote-tracking branch 'origin/master' into staging-next
The hash for pytensor is not correct, but that's also the case in
master, so a merge commit isn't the place to fix it.

Conflicts:
	pkgs/development/python-modules/faadelays/default.nix
	pkgs/development/python-modules/pytensor/default.nix
	pkgs/tools/admin/rset/default.nix
2023-10-05 08:02:48 +00:00
Anderson Torres
a9d73dea16 treewide: remove cstrahan from meta.maintainers - part 2
19 files modified with this removal
2023-10-04 22:20:58 -03:00
Raito Bezarius
6783b22c9e rustc: support clang-based stdenv
Previously, we were passing `cc` and `c++` all the time to rustc bootstrap process.

This was wrong because `cc-rs` relies on the name of the compiler to detect whether this is Clang or a GNU GCC.

Related:

[1]: df2f86ceaf/src/lib.rs (L3334)
[2]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Missing.20dynamic.20libraries.20when.20bootstrapping.20Rust/near/377914373
2023-09-29 05:13:17 +02:00
Adam Joseph
c1df604e9f rust: add rust.envVars 2023-09-26 06:30:44 +00:00
figsoda
26f43f17e4 rustc: 1.72.0 -> 1.72.1
https://blog.rust-lang.org/2023/09/19/Rust-1.72.1.html
https://github.com/rust-lang/rust/compare/1.72.0...1.72.1
https://github.com/rust-lang/rust/releases/tag/1.72.1
2023-09-22 08:32:44 +10:00
Asad Mehmood
9ee10432a4 rust: cargo: Use rustc and cargo built on Build
When cross-compiling a rust package, all we need is the std library compiled
for the target. This uses the final stage compiler which was built for Build
and then uses that as a stage0 compiler for target std library.

It also copies the rust binary from pkgsBuildBuild so that it find the new
lib/rustlib directory.

We also need to create a cargo wrapper which will use the "new" rust compiler

Also makes sure man pages and doc pages are propagated

Co-authored-by: Alyssa Ross <hi@alyssa.is>
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Co-authored-by: Rick van Schijndel <Mindavi@users.noreply.github.com>
2023-09-10 14:48:39 +02:00
figsoda
1e162f37fe rustc: 1.71.1 -> 1.72.0
https://blog.rust-lang.org/2023/08/24/Rust-1.72.0.html
https://github.com/rust-lang/rust/releases/tag/1.72.0
2023-08-27 20:48:18 +08:00
Adam Joseph
bac515fa9d
cargo-auditable-cargo-wrapper: don't wrap if cargo-auditable is meta.broken (#250615)
Recent changes to `cargo-auditable-cargo-wrapper` and `librsvg`
caused it to ignore the user's decision to opt out of `cargo-audit`
functionality, partially because `librsvg` does not use
`buildRustPackage`.

This commit restores the single-point-of-opt-out from this mis-named
functionality: `cargo-auditable.meta.broken`.

Co-authored-by: figsoda <figsoda@pm.me>
2023-08-26 16:07:05 -05:00
Theodore Ni
73cee93656
Merge pull request #248957 from figsoda/auditable
cargo-auditable-cargo-wrapper: fix wrapper
2023-08-23 08:48:35 -07:00
Artturin
b93da3f4b7 treewide: overrideScope' -> overrideScope
`lib.makeScope` `overrideScope'` has been renamed to `overrideScope`

`fd --type f | xargs sd --string-mode "overrideScope'" "overrideScope"`
2023-08-14 18:46:47 +03:00
figsoda
dc7cdbe466 cargo-auditable-cargo-wrapper: add test 2023-08-13 14:50:43 -04:00
figsoda
8522d789be cargo-auditable-cargo-wrapper: fix wrapper
Packages were not correctly built with carog-auditable due to the
missing auditable flag
2023-08-13 14:44:19 -04:00
Sandro Jäckel
e594a0fc14 cargo-auditable: fix cross compilation
This fixes the following error:
...
cargo-auditable>    Doc-tests auditable-extract
cargo-auditable> error: doctest failed, to rerun pass `-p auditable-extract --doc`
cargo-auditable>
cargo-auditable> Caused by:
cargo-auditable>   could not execute process `rustdoc --edition=2018 --crate-type lib --crate-name auditable_extract --test /build/source/auditable-extract/src/lib.rs --target x86_64-unknown-linux-gnu -L dependency=/build/source/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/build/source/target/release/deps --test-args --test-threads=96 --extern auditable_extract=/build/source/target/x86_64-unknown-linux-gnu/release/deps/libauditable_extract-dd1904617e4b78db.rlib --extern binfarce=/build/source/target/x86_64-unknown-linux-gnu/release/deps/libbinfarce-2ba09d21aed0de1a.rlib -C embed-bitcode=no --error-format human` (never executed)
cargo-auditable>
cargo-auditable> Caused by:
cargo-auditable>   No such file or directory (os error 2)

Tested with lanzaboote
2023-08-11 09:40:05 +01:00
figsoda
a3b4944004 rustc: 1.71.0 -> 1.71.1
https://blog.rust-lang.org/2023/08/03/Rust-1.71.1.html
https://github.com/rust-lang/rust/compare/1.71.0...1.71.1

fixes CVE-2023-38497: https://blog.rust-lang.org/2023/08/03/cve-2023-38497.html
2023-08-04 09:27:32 -04:00
figsoda
45e33f6672 rustc: build rust-analyzer-proc-macro-srv
It was incorrectly removed in https://github.com/NixOS/nixpkgs/pull/243283
2023-07-24 14:35:23 -04:00
figsoda
8f4874ca39 rustc: 1.70.0 -> 1.71.0
https://blog.rust-lang.org/2023/07/13/Rust-1.71.0.html

https://github.com/rust-lang/rust/releases/tag/1.71.0
2023-07-14 10:16:41 -04:00
Sandro
9a705f9834
Merge pull request #242749 from reckenrode/rustc-darwin-cleanup
rustc: remove Darwin special-casing
2023-07-11 21:32:30 +02:00
Randy Eckenrode
5df1c24a27
rustc: remove Darwin special-casing
An attempt to remove it was made in #106886, but there was a build
failure. Since that failure no longer occurs, remove it now.

Based on thefloweringash/nixpkgs@1904236648.
2023-07-10 14:53:30 -06:00
Randy Eckenrode
93320f3e30
rustc: link libc++abi on Darwin 2023-07-08 07:33:04 -06:00
Alyssa Ross
f2e0e190f5
rustc: mark supported on loongarch64
loongarch64 is tier 2 with host tools.
2023-06-25 13:23:47 +00:00
github-actions[bot]
af7beed7be
Merge master into staging-next 2023-06-16 06:01:09 +00: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
Francesco Gazzetta
131808261a rustc: use llvm_16
https://github.com/rust-lang/rust/releases/tag/1.70.0 (Internal Changes)
https://github.com/rust-lang/rust/pull/109474/
2023-06-07 11:06:13 +02:00
figsoda
ff16966860 rustc: 1.69.0 -> 1.70.0
https://github.com/rust-lang/rust/releases/tag/1.70.0
2023-06-01 15:00:58 -04:00
figsoda
a95a7508a5
Merge pull request #233521 from alyssais/cargo-cross-broken
cargo: mark broken for cross compilation to x86
2023-05-22 22:40:15 -04:00
Alyssa Ross
467c7ca038
cargo: mark broken for cross compilation to x86 2023-05-23 01:23:44 +00:00
Alyssa Ross
adb54ab7bd rustc: remove unused argument 2023-05-22 21:46:08 +00:00
figsoda
15f699fbf9 rustfmt: fix warning
rustPlatform.rust has been deprecated in https://github.com/NixOS/nixpkgs/pull/230951
2023-05-12 19:49:14 -04:00
Javier Olaechea
dd584d82f1 rustfmt: fix on darwin
Reading this [rust-issue] it seems that we have to link against
rustc_driver. The [clippy.nix] expression already does something similar

Of the 4 executables found in the result of building rustfmt only
rustfmt and git-rustfmt needed to be linked. The other worked without
linking to rustc_driver.

[rust-issue]: https://github.com/rust-lang/rust/pull/105609
[clippy.nix]: c8cf570dae/pkgs/development/compilers/rust/clippy.nix (L27-L36)
2023-05-12 18:44:20 -04:00
Alyssa Ross
46cb0eb1a9 rustPlatform.rust: deprecate
It is almost never correct to use these attributes, because they don't
work correctly with splicing.  Compare:

	% nix repl -f . --argstr crossSystem aarch64-linux
	Welcome to Nix 2.10.3. Type :? for help.

	Loading installable ''...
	Added 18988 variables.
	nix-repl> callPackage ({ stdenv, rustc }: (stdenv.mkDerivation { name = ""; nativeBuildInputs = [ rustc ]; }).nativeBuildInputs) {}
	«derivation /nix/store/bjrkg8kcq3hvg5kb03ivb856zy91qpbk-aarch64-unknown-linux-gnu-rustc-1.69.0.drv» ]

	nix-repl> callPackage ({ stdenv, rustPlatform }: (stdenv.mkDerivation { name = ""; nativeBuildInputs = [ rustPlatform.rust.rustc ]; }).nativeBuildInputs) {}
	«derivation /nix/store/ra5r07j52y7akclr827r3dzxzvqnvfbl-rustc-1.69.0.drv» ]

I'm not sure this is fixable.  I don't think it's worth keeping them
around considering we have top level attributes.  It makes overriding
slightly more annoying, but only slightly.
2023-05-12 15:31:21 +00:00
Alyssa Ross
5e06b3cb19 treewide: don't use rustPlatform.rust
This will be deprecated in the next commit.
2023-05-12 15:31:21 +00:00
Alyssa Ross
454b2058d4
rustc: fix name when cross compiled
I made a mistake when trying to add the target prefix to Rust cross
compilers: pkgsCross.aarch64-multiplatform.rustc ended up being called
"aarch64-unknown-linux-gnu-rustc-aarch64-unknown-linux-gnu-1.69.0",
which is a bit verbose.

With this change:

	nix-repl> rustc.name
	"rustc-1.69.0"

	nix-repl> pkgsCross.aarch64-multiplatform.buildPackages.rustc.name
	"aarch64-unknown-linux-gnu-rustc-1.69.0"

	nix-repl> pkgsCross.aarch64-multiplatform.rustc.name
	"rustc-aarch64-unknown-linux-gnu-1.69.0"

As intended.

Fixes: 57e73d23bb ("rustc,rustPlatform.buildRustPackage: broaden platforms")
2023-05-09 20:13:45 +00:00
github-actions[bot]
c9a253ff7f
Merge staging-next into staging 2023-04-25 12:02:03 +00:00
github-actions[bot]
a39805cda2
Merge master into staging-next 2023-04-25 12:01:31 +00: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
37a9ea8f4a cargo-auditable-cargo-wrapper: use more descriptive name 2023-04-24 23:41:03 +00:00
Alyssa Ross
a19acef56f cargo-auditable-cargo-wrapper: use makeWrapper 2023-04-24 23:41:03 +00:00
Luka Blaskovic
081c90ff3b rustc: 1.68.2 -> 1.69.0 2023-04-23 11:44:01 +10:00
github-actions[bot]
cf8e955712
Merge master into staging-next 2023-04-23 00:02:24 +00:00
Adam Joseph
0ac955ad63 rust/cargo.nix: set HOST_PKG_CONFIG_PATH for cross builds
Prior to this commit, builds of
`pkgsCross.aarch64-multiplatform.cargo` would fail due to being
unable to find `-lz` when compiling cargo's own `build.rs` for the
`buildPlatform`.

This environment variable uses the (very confusing) LLVM convention
of calling the buildPlatform "HOST".

Co-authored-by: figsoda <figsoda@pm.me>
2023-04-22 14:41:58 -07:00