Commit Graph

686 Commits

Author SHA1 Message Date
Yueh-Shun Li
57793b8ca7 rustPlatform.buildRustPackage: drop cargoSha256 2025-02-24 02:59:04 +08:00
Yueh-Shun Li
721751bd23 buildRustPackage: reformat after refactoring 2025-02-21 00:44:21 +08:00
Yueh-Shun Li
7609cbad7c buildRustPackage: restructure with lib.extendMkDerivation
Support fixed-point arguments with lib.extendMkDerivation

Postpone formatting for more concise diff.
2025-02-21 00:42:27 +08:00
Yueh-Shun Li
016ba92a43 buildRustPackage: avoid global assertions
Move assertions down to the corresponding attribute value.

Avoid adding assertions to the whole argument set.
2025-02-21 00:42:27 +08:00
K900
ef9eef8d21 Merge remote-tracking branch 'origin/master' into staging-next 2025-02-15 17:19:02 +03:00
TomaSajt
90ca0500a3 rustPlatform.fetchCargoVendor: use proxyImpureEnvVars 2025-02-15 18:30:00 +08:00
K900
8cd566539b rustPlatform.fetchCargoVendor: set strictDeps and dontConfigure by default (#377164) 2025-02-09 09:31:56 +03:00
K900
1446a9364a cargoCheckHook: pass test-threads using an environment variable (#368699) 2025-02-09 09:28:17 +03:00
Immae
52887dda76 replace-workspace-values.py: Allow "package" key in Cargo.toml dependencies (#377721)
* Allow "package" key in Cargo.toml dependencies
* Update replace-workspace-values.py

Some dependencies in Cargo.toml have a "package" key, which serves as an alias:
```
foo = { package = "original-name" ... }
```
which with nixpkgs triggered
```
       > Copying to /nix/store/jay72vz43afnlymsah7v543zmnv6l7ck-gcli-0.3.0-vendor/subxt-0.37.0
       > Patching /nix/store/jay72vz43afnlymsah7v543zmnv6l7ck-gcli-0.3.0-vendor/subxt-0.37.0/Cargo.toml
       > Traceback (most recent call last):
       >   File "/nix/store/harh7nnnib9896dwqr0xjqrr0l8wdcw7-replace-workspace-values/bin/replace-workspace-values", line 127, in <module>
       >     main()
       >   File "/nix/store/harh7nnnib9896dwqr0xjqrr0l8wdcw7-replace-workspace-values/bin/replace-workspace-values", line 104, in main
       >     changed |= replace_dependencies(workspace_manifest, crate_manifest)
       >                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       >   File "/nix/store/harh7nnnib9896dwqr0xjqrr0l8wdcw7-replace-workspace-values/bin/replace-workspace-values", line 77, in replace_dependencies
       >     changed |= replace_key(workspace_manifest, root[key], "dependencies", k)
       >                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       >   File "/nix/store/harh7nnnib9896dwqr0xjqrr0l8wdcw7-replace-workspace-values/bin/replace-workspace-values", line 58, in replace_key
       >     raise Exception(f"Unhandled keys in inherited dependency {key}: {local_dep}")
       > Exception: Unhandled keys in inherited dependency codec: {'package': 'parity-scale-codec'}
       > Traceback (most recent call last):
       >   File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 314, in <module>
       >     main()
       >   File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 310, in main
       >     subcommand_func()
       >   File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 302, in <lambda>
       >     "create-vendor": lambda: create_vendor(vendor_staging_dir=Path(sys.argv[2]), out_dir=Path(sys.argv[3]))
       >                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       >   File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 259, in create_vendor
       >     copy_and_patch_git_crate_subtree(git_tree, pkg["name"], crate_out_dir)
       >   File "/nix/store/qrf1j1w95va92fzv55lxpvw2dpm03bnr-fetch-cargo-vendor-util/bin/fetch-cargo-vendor-util", line 215, in copy_and_patch_git_crate_subtree
       >     subprocess.check_output(cmd)
       >   File "/nix/store/qrc496n6fsqp4p5m5h8wmw5d5jwyw5mr-python3-3.12.8/lib/python3.12/subprocess.py", line 466, in check_output
       >     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
       >            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       >   File "/nix/store/qrc496n6fsqp4p5m5h8wmw5d5jwyw5mr-python3-3.12.8/lib/python3.12/subprocess.py", line 571, in run
       >     raise CalledProcessError(retcode, process.args,
       > subprocess.CalledProcessError: Command '['replace-workspace-values', '/nix/store/jay72vz43afnlymsah7v543zmnv6l7ck-gcli-0.3.0-vendor/subxt-0.37.0/Cargo.toml', '/nix/store/c4jdggg9ihgi032pyc7g6ysdpb30xv1r-gcli-0.3.0-vendor-staging/git/00f181c1a5d8986e7146ddc72a745c793a9a1d8e/Cargo.toml']' returned non-zero exit status 1.
```
This fixes that
2025-02-08 23:44:37 +01:00
Jörg Thalheim
63a327bd87 rust/hooks: move tests to hooks and add to passthru (#379269) 2025-02-06 05:28:37 +01:00
DavHau
154f977ac6 rust/hooks: move tests to hooks and add to passthru 2025-02-04 12:02:15 +07:00
nixpkgs-ci[bot]
528ae2d8c7 Merge staging-next into staging 2025-02-04 00:14:40 +00:00
Alyssa Ross
9bc77ee0d7 rustPlatform.fetchCargoTarball: deprecate 2025-02-03 20:06:57 +01:00
nixpkgs-ci[bot]
9e06c2d43e Merge staging-next into staging 2025-02-02 00:15:30 +00:00
K900
d44bbfd49c Merge remote-tracking branch 'origin/master' into staging-next 2025-02-02 00:08:43 +03:00
Jörg Thalheim
c8b5329e7a rust: fix splicing for rust hooks (#369424) 2025-02-02 00:48:20 +07:00
DavHau
db4cf6cb1d rust: fix splicing for rust hooks
This fixes a long standing issue where rust hooks behave differently when used inside buildRustPackage vs inside mkDerivation, which lead to surprising behavior, like for example the package being built for the wrong paltform or the linker not being found especially in cross compilation scenarios.

The reason for this inconsitency was, that buildRustPackage consumed the hooks in a non-spliced form, via [this inherit statement](4506ece030/pkgs/development/compilers/rust/make-rust-platform.nix (L60)), and therefore the usual platform shift on the hooks introduced by putting them in `nativeBuildInputs` was not applied here.

Thoug whenever the hook was used inside other builders like `mkDerivation` the platform shift did apply correctly as the hook was consumed via the spliced package set, introducing the inconsitecy.

Because of the wrong (non-spliced) use in buildRustPackage, most rust hooks have been designed with the wrong build/host/target shift in mind which is fixed by this change.

Due to the inconsitent behavior between different builders, workarounds like `rust.envVars`, which were previously introduced, likely become obsolete by this change.

This likely fixes a bunch of cross compilation issues for rust packages that are not based on `buildRustPackage` but instead consume the hooks directly.

Done:
- ensure that `buildRustPackage` consumes spliced hooks by using makeScopeWithSplicing' in make-rust-platform.nix.
- refactor hooks to make them refer to correct build/host/target packages.
- remove `rust.envVars` workaround from all rust hooks
- implement tests for most rust hooks in /pkgs/test/rut-hooks

The newly added tests can be executed for native as well as cross compilation via:
```
nix-build -A tests.rust-hooks -A pkgsCross.riscv64.tests.rust-hooks
```
2025-01-31 18:18:46 +07:00
DavHau
4e54dd0c51 format pkgs/build-support/rust/hooks/default.nix 2025-01-31 18:18:46 +07:00
Sandro
8f81834727 rustPlatform.fetchCargoVendor: reuse http session across requests (#377632) 2025-01-30 22:03:28 +01:00
Alyssa Ross
c8127fc287 build-support/rust/sysroot: remove
The sysroot derivation used by buildRustPackage hasn't built since
c263e0b33b ("cargo,clippy,rustc,rustfmt: 1.81.0 -> 1.82.0").  That
means that it's never built on 24.11, so there can't be anybody
relying on it working on any supported version Nixpkgs.  In the
meantime, it's causing maintenance friction — I've spent a lot of time
trying to figure out how to build it as part of the transition away
from fetchCargoTarball, before realising that it doesn't work anyway
and must be unused.  It can come back in the future if somebody wants
to maintain it.
2025-01-30 16:24:14 +01:00
Alyssa Ross
97fc6f36d0 Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
	pkgs/by-name/ez/eza/package.nix
	pkgs/by-name/re/rewatch/package.nix
	pkgs/by-name/rq/rqbit/package.nix
	pkgs/development/python-modules/diffusers/default.nix
	pkgs/development/python-modules/manga-ocr/default.nix
	pkgs/development/tools/misc/texlab/default.nix
2025-01-30 15:02:26 +01:00
Alyssa Ross
b55dd979b8 fetchCrate: expose pname and version in passthru 2025-01-30 10:26:44 +01:00
Defelo
1244a54f74 rustPlatform.fetchCargoVendor: reuse http session across requests 2025-01-28 23:43:32 +01:00
Alyssa Ross
35febc093c Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
	pkgs/by-name/ha/harper/package.nix
2025-01-28 13:29:32 +01:00
Alyssa Ross
f07977cfd2 rustPlatform.fetchCargoVendor: add allowGitDependencies
This will make it possible to use fetchCargoVendor for packages that
are in the dependency graph of nix-prefetch-git, by having them opt
out of having nix-prefetch-git involved in fetching their
dependencies.
2025-01-28 12:52:12 +01:00
TomaSajt
e96c70a7ff rustPlatform.fetchCargoVendor: set strictDeps and dontConfigure by default 2025-01-28 12:16:52 +01:00
nixpkgs-ci[bot]
3833577ea0 Merge staging-next into staging 2025-01-21 12:32:11 +00:00
Florian Klink
8956e27ebc defaultCrateOverrides: remove obsolete darwin frameworks (#374416) 2025-01-21 14:20:57 +02:00
Wolfgang Walther
546ece569b libpq: init at 17.2
Resolves #61580
2025-01-19 12:49:21 +01:00
Niklas Korz
514d472504 defaultCrateOverrides: remove obsolete darwin frameworks 2025-01-17 02:48:58 +01:00
TomaSajt
0bfdb03af3 rustPlatform.importCargoLock: support lockfile v4 escaping 2025-01-08 11:25:35 +05:30
TomaSajt
1db27e9394 rustPlatform.fetchCargoVendor: support lockfile v4 escaping 2025-01-08 11:25:35 +05:30
Martin Weinelt
8a1acc97d1 rustPlatform.maturinBuildHook: specify the interpreter name (#365540) 2024-12-31 15:34:02 +01:00
misuzu
5e06bab187 rustPlatform.maturinBuildHook: specify the interpreter name
Required for cross-compilation.
2024-12-29 18:29:18 +02:00
lucasew
f9a85f2330 cargoCheckHook: pass test-threads using an environment variable
Signed-off-by: lucasew <lucas59356@gmail.com>
2024-12-27 22:37:02 -03:00
Arne Keller
fa509ecc7a rust: adjust env definition order (#358989) 2024-12-18 17:59:36 +01:00
Silvan Mosberger
667d42c00d treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev 57b193d8dd
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:27:17 +01:00
Silvan Mosberger
84d4f874c2 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev 78e9caf153
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:23:58 +01:00
K900
2236e731a3 Merge remote-tracking branch 'origin/master' into staging-next 2024-12-06 21:27:37 +03:00
Aleksana
9127655f5e rustPlatform.fetchCargoTarball: dontConfigure (by default) (#360540) 2024-12-06 22:46:00 +08:00
github-actions[bot]
df7560310e Merge staging-next into staging 2024-12-03 12:06:35 +00:00
TomaSajt
16f30cf210 {buildRustPackage,fetchCargoTarball,fetchCargoVendor}: respect cargoRoot 2024-12-02 22:10:23 +01:00
Doron Behar
0d2b54f022 rustPlatform.fetchCargoTarball: dontConfigure (by default) 2024-11-30 22:11:18 +02:00
github-actions[bot]
8cfd862ce8 Merge staging-next into staging 2024-11-27 12:06:39 +00:00
TomaSajt
455241a036 buildRustPackage: fix passing depsExtraArgs to fetchCargoVendor 2024-11-26 08:48:06 +01:00
Clément DOUIN
87b0101964 rust: adjust env definition order 2024-11-25 13:58:09 +01:00
github-actions[bot]
468547492b Merge staging-next into staging 2024-11-22 18:05:01 +00:00
Robert Schütz
6c4d710b94 rustPlatform.buildRustPackage: allow specifying cargoDeps 2024-11-19 10:47:22 -08:00
github-actions[bot]
40a26e9ba0 Merge staging-next into staging 2024-11-19 18:04:59 +00:00
TomaSajt
63565778a2 rustPlatform.fetchCargoVendor: retry fetching tarballs 2024-11-19 14:11:12 +01:00