Commit Graph

37 Commits

Author SHA1 Message Date
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
6fd78bc66a
Add path as a convenience wrapper around builtins.path (#273) 2023-03-19 20:57:15 -07: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
00564437f3
Properly handle workspace inheritance in git dependencies (#224)
Crates from git repos are vendored in a flattened directory where each crate shows up at the root of the vendor directory. Since the vendoring step effectively breaks workspace structures, any crates which use workspace inheritance (e.g. package.version.workspace = true will fail to resolve.

To work around this we inspect the crate's workspace manifest (if it exists) and attempt to manually merge the values while copying the contents to the vendor directory.
2023-01-21 16:46:32 -08:00
Ivan Petkov
2ce1a3313e
Eliminate dead code (#148) 2022-10-23 23:20:22 +00:00
Ivan Petkov
0b71f12fc7
Add cargoTest for running crate tests (#132) 2022-10-09 21:00:17 +00: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
c12fec0a8b
Add cleanCargoSource and filterCargoSources (#110) 2022-09-21 01:27:47 +00:00
Ivan Petkov
4f691ac0ce
cargoDoc: add ability to run cargo doc on a workspace (#107) 2022-09-20 01:05:43 +00: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
9eb8357f53
Reformat nix files 2022-07-09 20:20:15 -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
5c8e7f732f
Fix callPackage scopes for build hooks so cross compiling works
* Previously all build hooks were instantiated in a single
  `callPackages` call which led to several issues:
  - changes via `lib.overrideScope'` were ignored because the build
    hooks were only ever instantiated with the nixpkgs instance of our
    flake (not whatever overlays the caller may have made)
  - the pkgs splicing was not done quite right, meaning when we pull in
    the build hooks as nativeBuildInputs the splicing wasn't picking up
    the overridden versions of `cargo` but was instead trying to
    recompile the nixpkgs version each time
2022-02-14 18:31:45 -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
5e44613211 Make crate downloads aware of alternative registries 2022-01-30 23:58:56 +00:00
Ivan Petkov
5bae4b91c1 Optimize searching for cargo configuration files
* Rather than recursively look up all paths in a given project and then
  filtering for cargo-specific files, we now use our own customized
  traversal method to only capture the results we want.
2022-01-30 23:58:56 +00:00
Ivan Petkov
aeb598b174
Add cargoTarpaulin 2022-01-16 18:16:21 -08:00
Ivan Petkov
438154f265
Add cargoFmt 2022-01-16 17:49:39 -08:00
Ivan Petkov
3f82111135
Merge vendorCargoDepsFromArgs into vendorCargoDeps 2022-01-08 17:52:10 -08:00
Ivan Petkov
ba50659d0d
Rename buildWithCargo to cargoBuild 2022-01-04 14:18:29 -08:00
Ivan Petkov
66db381bac
Add cargoClippy 2022-01-04 12:07:32 -08:00
Ivan Petkov
f69c8a4c44
Add buildPackage for building and installing cargo packages 2022-01-03 14:32:51 -08:00
Ivan Petkov
47316bfe5b
Add vendorCargoDepsFromArgs
* This abstracts the path checking and message raised on errors into a
  reusable function
2022-01-03 10:28:56 -08:00
Ivan Petkov
4c1711399d
Split out buildWithCargo into a lower level mkCargoDerivation
* The intention here is to split up different "responsibilities" into
  smaller parts which can be composed as a DAG rather than mutually
  recursive functions. Specifically:
* `mkCargoDerivation` represents a lower-level thin wrapper around
  `stdenv.mkDerivation` which will
  - set up hooks
  - require the caller to define the variables needed by the hooks (like
    vendor dir, or artifacts to inherit)
  - ensure that build/check/install phases can be configured by the
    caller without having them remember to call pre/post hooks
* This allows `buildDepsOnly` to only focus on setting some default
  values (like good default commands to build all artifacts, setting the
  derivation name, etc.) and delegating the rest to `mkCargoDerivation`
* Lastly, the responsibility of `buildWithCargo` ends up ensuring that
  `cargoArtifacts` and `cargoVendorDir` are defined if the caller does
  not pass them in
2022-01-02 14:48:32 -08:00
Ivan Petkov
0aadea3b08
Rename buildWithDummySrc to buildDepsOnly 2021-12-30 14:49:52 -08:00
Ivan Petkov
2339d7959f
Add buildWithDummySrc
* This also implements automatically building dependencies in a separate
  derivation if `buildWithCargo` is invoked without `cargoArtifacts`
2021-12-30 14:46:35 -08:00
Ivan Petkov
3223e4860e
Add mkDummySrc 2021-12-30 13:22:05 -08:00
Ivan Petkov
cf1c6eb0e8
Add checks for cleanCargoToml 2021-12-29 19:26:55 -08:00
Ivan Petkov
a286fe1ff5
Add cleanCargoToml 2021-12-29 16:03:39 -08:00
Ivan Petkov
e1b7cea23c
Add buildWithCargo as a thin wrapper around mkDerivation 2021-12-26 16:27:09 -08:00
Ivan Petkov
83632355d2
Add configureCargoVendoredDepsHook 2021-12-26 16:21:08 -08:00
Ivan Petkov
3af378cfd7
Implement vendoring cargo dependencies 2021-12-26 14:05:23 -08:00
Ivan Petkov
2cec871d53
Initial commit 2021-12-26 11:47:59 -08:00