Commit Graph

94 Commits

Author SHA1 Message Date
Ivan Petkov
7d5b46c17d
Update docs (#514)
* vendorCargoDeps: update error message to hint towards staging Cargo.lock
* crateNameFromCargoToml: update docs to note directory are not crawled
2024-02-04 19:31:22 +00:00
Charles Hall
0327ca9d77
force buildDepsOnly to produce out only (#493)
This allows multi-output derivations using e.g. `buildPackage` to work.
Without this change, they fail to build because Nix thinks
`buildDepsOnly` is supposed to produce mulitple outputs too, but it
doesn't.

---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2024-01-27 17:52:30 +00:00
Leonardo Eugênio
2a5136f14a
buildTrunkPackage: Add "wasm-bindgen-cli" argument (#363) 2023-12-20 08:24:53 -08:00
Ivan Petkov
537ebb11db
docs: add note about avoiding pyo3 rebuilds (#486) 2023-12-19 03:30:44 +00:00
Ivan Petkov
c53a8c071d
buildDepsOnly: pass --no-run to cargo test by default (#470) 2023-11-30 00:43:47 +00:00
Ivan Petkov
3aaa2c5ddb
fix: avoid path starts with illegal character error (#459)
* Looks like Nix 2.19.0 doesn't like it when a path starts with `.` so
  this updates the examples and tests to avoid doing that
2023-11-26 10:15:16 -08:00
Ivan Petkov
f1c2fe6716
installCargoArtifactsHook: allow specifying additional zstd args (#450) 2023-11-05 20:34:43 +00:00
Ivan Petkov
2b1203872d
chore: clean up some dead code warnings (#449) 2023-11-05 18:42:08 +00:00
Ivan Petkov
758ae44222
installCargoArtifactsHook: change default installation mode to use-zstd (#442) 2023-10-20 22:28:41 +00:00
Aidan Gauland
f8f1b3fc5b
cargoLib.cargoDeny: init (#440)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-10-20 21:45:03 +00:00
Ivan Petkov
6b229eec8a
fix: correct installFromCargoBuildLogHook docs 2023-10-20 07:11:01 -07:00
Ivan Petkov
eb5034b6ee
replaceCargoLockHook: run as prePatchHook not postUnpack (#434) 2023-10-17 03:31:33 +00:00
Ivan Petkov
f2b70c85d5
devShell: add clippy and rustfmt from the current toolchain (#432) 2023-10-17 00:24:15 +00:00
simonzkl
47f84c5b60
removeReferencesToVendoredSources: sign aarch64-darwin binaries (#418)
---------

Co-authored-by: Simon Zlender <simonz@btcx.com>
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-10-15 20:09:08 +00:00
Ivan Petkov
4dcf584de1
mkCargoDerivation: replace Cargo.lock with contents of cargoLock (#425)
* The vendoring helpers already accept a `cargoLock` override, so
  automatically linking it in the derivation (if set) makes it a bit
  easier without having the caller manually do the link themselves
2023-10-15 01:42:24 +00:00
Ivan Petkov
ce0a13f8ba
cargoAudit: ignore yanked crates by default (#423)
* Checking for yanked crates requires network access (to ping the
  crates.io index) which won't work from inside the sandbox
2023-10-14 21:50:48 +00:00
Marijan Petričević
a863ce3c79
fix #404 - lib/cargoTarpaulin: lowercase --out xml argument (#405) 2023-10-01 11:22:09 -07:00
Jörg Thalheim
16f5732c14
allow to pass outputHashes to crane (#266)
This makes it possible to evaluate crane in a nixos test without network
as well as allow to backup all fetched input derivations properly in a
binary cache, whereas fetchGit will fallback to downloading from a
repository, which also requires a `git` binary to be present.

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-09-22 04:08:53 +00:00
Rebecca Turner
7b92b595c9
Add devshell helper (#378) 2023-09-03 10:33:10 -07:00
Ivan Petkov
ecf151658e
cargoDoc: do not install cargo artifacts by default (#381)
* Also install generated docs
2023-09-03 10:29:13 -07:00
Ivan Petkov
43db881168
various: change cargoExtraArgs defaults to include --locked (#373) 2023-08-27 19:17:58 +00:00
Leonardo Eugênio
1b8653ad52
Trunk: use native dart-sass (#360)
Replace the javascript version of dart-sass with a native binary version.
Should improve built times and reduce disk usage.

---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-08-11 00:38:14 +00:00
Ivan Petkov
116b32c30b
inheritCargoArtifactsHook: allow disabling symlink behavior (#345) 2023-06-21 01:13:46 +00:00
Ivan Petkov
bd65e0e473
inheritCargoArtifactsHook: symlink dependency rlib and rmeta files (#344)
* cargoTarpaulin: do not clean by default

---------

Co-authored-by: Philipp Mildenberger <philipp@mildenberger.me>
Co-authored-by: Philipp Mildenberger <philipp.mildenberger@artfabrik.at>
2023-06-19 21:50:17 +00:00
James Baker
75f7d715f8
Natively support sparse registries (#324)
With Cargo 1.68.0, sparse registries were made stable. With sparse
registries, index metadata is stored in an HTTP api rather than in
a git repository.

As relevant to Crane, the relevant changes are mostly that registries
do not always start with `registry+` and mostly start with `registry+`
or `sparse+` depending on whether the registry is sparse or not.

This PR adjusts the core of Crane to differentiate between `registry`
and `sparse`, and adds a new sparse registry factory to make things
easy.

---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-06-13 02:03:18 +00:00
Ivan Petkov
057d95721e
Add support for installing dylib crate types (#340)
---------

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Roman Volosatovs <rvolosatovs@riseup.net>
2023-06-08 01:00:25 +00:00
Uosis
3acc7230ee
Clean install hooks from buildDepsOnly invocation (#334)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-06-07 05:38:53 +00:00
Leonardo Eugênio
db21a44eb0
Trunk support (#299)
[Trunk](https://trunkrs.dev) is a tool that allow you to build web apps
using Rust and webassembly, including compiling scss, and distributing
other assets.

Adds `craneLib.buildTrunkPackage`, a function that builds a Trunk
project returning a directory with the resulting dist files for that
project

---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-04-29 12:34:39 -07:00
Ivan Petkov
0c9f468ff0
buildPackage: don't inherit installPhase when calling buildDepsOnly (#297) 2023-04-11 01:37:58 +00:00
Ivan Petkov
f491bee4f9
Add support for building standard library crates (#287)
* vendorCargoRegistries: accept `registries` from the caller if specified
* Add vendorMultipleCargoDeps
2023-04-02 17:57:17 +00:00
Ivan Petkov
141943d26a
docs: replace references to lib with craneLib (#274)
* `lib` is already a common import representing `pkgs.lib`
* Consistently using `craneLib` in the docs and examples will ensure
  better clarity
2023-03-20 04:13:23 +00:00
Ivan Petkov
6fd78bc66a
Add path as a convenience wrapper around builtins.path (#273) 2023-03-19 20:57:15 -07:00
figsoda
77435dad14
feat: add cargoLockParsed option (#270)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-03-20 00:33:17 +00:00
figsoda
475de74fa2
feat: add cargoLlvmCov (#267)
* feat: add cargoLlvmCov
* cargoHelperFunctionsHook: prefer `--release` over `--profile release`
Some tools (e.g. cargo-llvm-cov) don't understand `--profile release` as
an alias for `--release`, so `cargoWithProfile` should prefer passing
`--release` when `$CARGO_PROFILE` == "release"

---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-03-19 23:44:14 +00:00
Ivan Petkov
6fb400ec63
crateNameFromCargoToml: warn when values can't be found (#237) 2023-02-12 00:39:43 +00:00
Ivan Petkov
8c34e5ecad
docs: Clarify docs and add example of setting custom environment variable (#233)
Clarify docs and add example of setting custom environment variable
2023-02-09 00:27:05 +00:00
Ivan Petkov
a41a7d3f81
Update docs to clarify buildPackage installation behavior (#225) 2023-01-22 00:50:20 +00:00
Ivan Petkov
0428181b7b
cleanCargoSource: fix documentation typo (#177) 2022-12-01 00:14:59 +00:00
Ivan Petkov
2b0be4c1c4
mkDummySrc: work with uefi targets by default, and allow downstream customization (#174)
* mkDummySrc: also include `no_std` attrs for target_os = uefi
* buildDepsOnly: only check with `--all-targets` if doCheck enabled
* mkDummySrc: allow customizing dummy Rust file contents
2022-11-28 03:23:35 +00:00
Ivan Petkov
e80de1e74a
Allow passing arbitrary fetchurl args per registry (#168)
Co-authored-by: Amos Wenger <amoswenger@gmail.com>
2022-11-20 16:22:13 -08:00
Ivan Petkov
c3935e06ca
removeReferencesToVendoredSourcesHook: use a single sed invocation (#167)
* Turns out it is much faster to build up one big regex of the
  references to remove and invoking `sed` just once than it is to invoke
  it once per reference
2022-11-17 17:00:25 -08:00
Robin Bozan
cc4865cd06
Fixes filterCargoSources example in documentation (#165) 2022-11-17 02:40:40 +00:00
Ivan Petkov
975bda728a
Change default cargo artifact installation to use symlinks where possible (#150)
* Define a new installation mode which symlinks identical artifacts
  against a directory of previously generated ones
* This allows for linear space usage in the Nix store across many
  chained derivations (as opposed to using a zstd compressed tarball
  which uses quadratic space across many chained derivations)
* This new installation mode is the new default for all cargo based
  builds. The previous behavior is still available by setting
  `installCargoArtifactsMode = "use-zstd";` on a derivation
* `buildPackage` will continue to use zstd compressed tarballs while
  building dependencies (unless either of `cargoArtifacts` or
  `installCargoArtifactsMode` is defined, in which case they will be
  honored)
2022-10-29 18:48:29 +00:00
Ivan Petkov
1bea2b5212
crateNameFromCargoToml: handle workspace inheritance (#144) 2022-10-16 17:12:31 +00:00
Ivan Petkov
d78cb0453b cargoBuild: do not run tests 2022-10-09 12:56:21 -10:00
Ivan Petkov
b84c191b59 buildDepsOnly: accept cargo{Check,Test}ExtraArgs 2022-10-09 12:56:21 -10:00
Ivan Petkov
17f4ff6ad7 buildPackage: use mkCargoDerivation instead of cargoBuild 2022-10-09 12:56:21 -10:00
Ivan Petkov
f27d6dd45d cargoTarpaulin: require that cargoArtifacts are specified 2022-10-09 11:33:57 -10:00
Ivan Petkov
a1e9a4197c
Fixup docs (#133) 2022-10-09 21:02:27 +00:00
Ivan Petkov
0b71f12fc7
Add cargoTest for running crate tests (#132) 2022-10-09 21:00:17 +00:00