Commit Graph

53 Commits

Author SHA1 Message Date
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
Ivan Petkov
1127ed2587 cargoNextest: use mkCargoDerivation instead of cargoBuild 2022-10-09 09:40:53 -10:00
Ivan Petkov
2b70a82caf cargoClippy: use mkCargoDerivation instead of cargoBuild 2022-10-09 09:40:53 -10:00
Ivan Petkov
0ad37656bc cargoTarpaulin: use mkCargoDerivation instead of cargoBuild 2022-10-09 09:40:53 -10:00
Ivan Petkov
8c97f06448 cargoAudit: use mkCargoDerivation instead of cargoBuild 2022-10-09 09:40:53 -10:00
Ivan Petkov
b61434b0b2 cargoDoc: use mkCargoDerivation instead of cargoBuild 2022-10-09 09:40:53 -10:00
Ivan Petkov
51bbfae3f6 cargoFmt: use mkCargoDerivation instead of cargoBuild 2022-10-09 09:40:53 -10:00
Ivan Petkov
cc7d69f1ed mkCargoDerivation: default to empty checkPhaseCargoCommand 2022-10-09 09:40:53 -10:00
Ivan Petkov
d4a3bee75f mkCargoDerivation: populate pname and version if not specified 2022-10-09 09:40:53 -10:00
Ivan Petkov
d3db2ecf01 mkCargoDerivation: automatically vendor deps if cargoVendorDir not set 2022-10-09 09:40:53 -10:00
Ivan Petkov
0017a8da68
flake: deprecate the packages flake output (#130)
Even though the setup hooks can be thought of as "packages", it makes
things much more simple to access everything from the same place
2022-10-09 10:28:48 -07:00
Ivan Petkov
fc545e6784
hooks: do not use substitutions for needed tools (#128)
* Using substitutions for build hooks is a great way to ensure the
  necessary utility is present without making the caller supply it to
  the builder, except it makes things confusing when applying overrides
* For example, the `installFromCargoBuildLog` hook was inadvertently
  ignoring any `cargo` overrides applied to the entire `lib`
  instantiation
* By removing all explicit substations we also side step the issue of
  trying to select the correct build/host/target version of the tool and
  use whatever is present in the build environment
2022-10-09 02:03:05 +00:00
Ivan Petkov
21e627606c
mkDummySrc: allow running a custom script after dummification is done (#116) 2022-09-27 06:25:09 +00:00
Ivan Petkov
06b1f7bd80
Improve stripping references to vendored sources (#120)
* Also add removeReferencesToVendoredSourcesHook
2022-09-24 23:45:56 +00:00
Ivan Petkov
c12fec0a8b
Add cleanCargoSource and filterCargoSources (#110) 2022-09-21 01:27:47 +00:00
Ivan Petkov
78f7d689fb
docs: fix typos (#109) 2022-09-20 01:08:24 +00:00
Ivan Petkov
4f691ac0ce
cargoDoc: add ability to run cargo doc on a workspace (#107) 2022-09-20 01:05:43 +00:00
Ivan Petkov
352c7ff1b8
mkCargoDerivation: add default configurePhase (#106)
This is done to avoid breaking builds by including puts happen to have
setup-hooks which try to claim the configure phase (such as `cmake`).

The old behavior can be brought back by setting `configurePhase = null;`
on the derivation.
2022-09-18 01:18:03 +00:00
Ivan Petkov
ca294409f3
mkCargoDerivation: allow ergonomically overriding stdenv (#101) 2022-09-15 10:20:48 -07:00
Ivan Petkov
dbda889c05
Replace source prefix mapping with remove-references-to (#90) 2022-08-28 01:44:07 +00:00
Ivan Petkov
185465a734
docs: tweak cargoBuild docs to mention doInstallCargoArtifacts (#77) 2022-08-14 03:20:49 +00:00
Ivan Petkov
8de515289f
cargoClippy: add --all-targets to default cargoClippyExtraArgs (#67)
* This allows callers to opt-out of using `--all-targets` without having
  to override the entire cargo command itself
2022-08-11 23:58:32 +00:00
Ivan Petkov
57448afcec
cargoAudit: filter source to only include Cargo.lock files (#56)
* Seems like cargo-audit only needs a `Cargo.lock` file and an advisory
  database to run, so we can filter the inputs down even further to
  avoid rebuilds and file copying into the Nix sandbox
2022-08-01 15:55:52 -07:00
ngerstle-cognite
50a021ad55
Add support for cargo audit (#53)
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2022-07-30 08:52:07 -07:00
Ivan Petkov
3c65d924ec
Add cargo-nextest 2022-07-23 16:29:05 -07:00
Ivan Petkov
d32c16a835
Correct docs on disabling CARGO_PROFILE from being used 2022-07-23 14:11:53 -07:00
Ivan Petkov
a2dd1b8ad4
Allow configuring which cargo profile is selected 2022-07-23 11:10:45 -07:00
Ivan Petkov
bce972e03b
Add cargoHelperFunctionsHook
* It will automatically capture and log all `cargo` invocations
2022-07-23 11:11:36 -07:00
Ivan Petkov
7fc1a8fec3
Remove --workspace from all default commands
* This allows for fewer assumptions about the project structure
* The old behavior can easily be brought back by setting `cargoExtraArgs
  = "--workspace";` in any derivation
2022-07-20 19:27:52 -07:00
Ivan Petkov
43aab4b7d8
Add .overrideToolchain convenience method 2022-06-26 11:25:40 -07:00
adisbladis
a1e56fba69 Stop passing around fromTOML
It's a builtin that we can just use directly.
2022-06-03 02:01:02 +08:00
adisbladis
2491382d63 Remove internal dependency on toTOML 2022-06-03 02:01:02 +08:00
Ivan Petkov
b47fafa717
buildDepsOnly: add --all-targets to default cargoCheckCommand
This allows caching all artifacts (including from dev-dependencies) such
that tools like clippy don't have to generate them every time they run.
2022-05-08 19:46:58 -07:00
Ivan Petkov
f8d1e70dfc
Fix handling of git repos whose rev is not on the main branch
* When Nix fetches a git repo it will only look for the specified
  revision only starting from the main branch (apparently fetching
  arbitrary revisions from a repository has some security implications)
* If a ref (i.e. branch or tag) is not specified, Nix will only fetch
  the repo's main branch
* To remedy this we will supply Nix with the branch or tag (if specified
  in the Cargo.lock) to help it find the specified revision
* If cargo does not specify a branch or tag for us, we'll set `allRefs =
  true` so that Nix can try fetching all possible branches and tags
  before trying to check out the locked revision
2022-02-18 18:10:53 -08:00
Ivan Petkov
3024283855
cargoClippy: change behavior to install cargo artifacts by default
* This allows potentially chaining `cargoClippy` invocations with other
  derivations
2022-02-13 09:34:26 -08:00
Ivan Petkov
472d7ffc99
Handle case where a git repo contains multiple crates 2022-02-10 20:32:31 -08:00
Ivan Petkov
ca73fc5305
Add support for git dependencies 2022-02-07 20:03:12 -08:00
Ivan Petkov
1ab0cad98c
Split out registry vendoring to vendorCargoRegistries 2022-02-06 17:16:49 -08:00
Ivan Petkov
90d5ad84c4
cargoFmt: change behavior to install cargo artifacts by default
* This allows potentially chaining `cargoFmt` invocations with other
  derivations
2022-02-10 21:02:48 -08:00
Ivan Petkov
492076c765 Rename registryFromGitIndex input to indexUrl for consistency 2022-01-30 23:58:56 +00:00
Ivan Petkov
47fbae6dc3 Add support for alternative cargo registries 2022-01-30 23:58:56 +00:00
Ivan Petkov
5e44613211 Make crate downloads aware of alternative registries 2022-01-30 23:58:56 +00:00