Commit Graph

44 Commits

Author SHA1 Message Date
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
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
d9f394e4e2
Document specifying/overriding a Cargo.lock file (#94) 2022-08-30 16:12:41 +00:00
Ivan Petkov
dbda889c05
Replace source prefix mapping with remove-references-to (#90) 2022-08-28 01:44:07 +00:00
Ivan Petkov
b5ac03b201
vendorGitDeps: ignore crates not referenced by Cargo.lock (#71) 2022-08-12 23:48:53 +00:00
Ivan Petkov
9682b9f7e1
checks: add test case for building crate with only tests (#61) 2022-08-11 00:19:07 +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
52568d052b
Conditionally gate nextest tests with multiple partitions 2022-07-23 16:51:28 -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
731a81056b
Remove nixpkgs-fmt check 2022-07-20 19:44:53 -07:00
Ivan Petkov
9eb8357f53
Reformat nix files 2022-07-09 20:20:15 -07:00
adisbladis
69c96f9d9e checks: Add a check that hits default.nix in the root
This is testing stable Nix (i.e. non-flakes).
2022-06-03 02:01:02 +08:00
Ivan Petkov
e78d9b8370
checks: enable tarpaulin checks only on x86_64-linux 2022-06-01 17:17:02 -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
05c8945db7
tests: switch back to runCommand from runCommandLocal
* Seems like cachix is still pushing the results up to the cache, we
  might as well get use of downloading the (empty) results rather than
  having to pull down the intermediary binaries and running them each
  time
2022-02-17 18:15:09 -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
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
e2c665091e
Add test that source prefix remapping works 2022-02-09 20:54:56 -08:00
Ivan Petkov
469f4a5fde
Fix git dependency handling of overlapping repos 2022-02-09 20:22:07 -08:00
Ivan Petkov
ca73fc5305
Add support for git dependencies 2022-02-07 20:03:12 -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
d4b5f8abe6
chore: switch to runCommandLocal to reduce network pressure 2022-01-30 16:10:41 -08:00
Ivan Petkov
492076c765 Rename registryFromGitIndex input to indexUrl for consistency 2022-01-30 23:58:56 +00:00
Ivan Petkov
4adc828133 Add example for using an alternative cargo registry 2022-01-30 23:58:56 +00:00
Ivan Petkov
715c8731c3 Add regression test for manually vendored dependencies 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
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
49ef407216
Rename doCopyTargetToOutput to doInstallCargoArtifacts
* Similarly rename `installCargoTargetDirHook` to
  `installCargoArtifactsHook`
* The intention is to highlight that "install" implies "copy to output"
  and not anywhere else
* Also avoids the potential confusion of "cargo target dir" (location of
  cargo's artifacts) with "cargo target" (which is the target
  architecture/platform we want cargo to build for)
2022-01-08 17:14:05 -08:00
Ivan Petkov
abc2c8c418
mkDummySrc: drop dummy lib.rs by default, not main.rs
* There are some edge cases where cargo will allow a lib.rs file to be
  present but not a main.rs (e.g. a binary cannot be called "examples",
  which will happen if the crate is called that and a main.rs file is
  present)
2022-01-07 20:42:24 -08:00
Ivan Petkov
bcec95e215
Add test for rooted workspace 2022-01-07 18:03:12 -08:00
Ivan Petkov
a8c6f256bc
Add tests for a simple workspace 2022-01-07 17:56:12 -08:00
Ivan Petkov
791f1b2241
Add tests for mkDummySrc
* Also fix a bug with copying over .cargo/config files
2022-01-05 20:46:05 -08:00
Ivan Petkov
daae0bac2b
Rename checks/cleanCargoToml directory for consistency 2022-01-05 20:14:45 -08:00
Ivan Petkov
7ec94f9653
Remove internally used parameters from derivations where possible
* By default we pass everything through to the actual derivation itself,
  but some internal parameters don't show up as environment variables
  directly (or rather do not need to)
* In an effort to keep the build environment as lean as possible, we can
  do some clean up (e.g. to avoid invalidating builds if some parameter
  changes but is completely ignored/overridden elsewhere)
2022-01-04 17:45:31 -08:00
Ivan Petkov
0f3e3e9a9b
Bring all tests back under nix flake check
* Seems like whatever issue was preventing us from evaluating
  derivations for other architectures (without actually building them)
  has been resolved, and now we can nicely test everything with a single
  invocation of `nix flake check`
2022-01-04 12:55:36 -08:00
Ivan Petkov
6925af0d0b
Move all tests (except for formatting) out of flake checks
* `nix flake check` insists on evaluating all outputs for all systems,
  which seems to include evaluating build inputs needed for other
  systems (which gives us errors like `a 'aarch64-darwin' with features
  {} is required to build '...', but I am a 'x86_64-linux'`)
* To work around this we'll move all tests to their own directory
  outside of the flake's outputs, and manually invoke a test script to
  build them
2021-12-30 17:18:17 -08:00
Ivan Petkov
cf1c6eb0e8
Add checks for cleanCargoToml 2021-12-29 19:26:55 -08:00
Ivan Petkov
2cec871d53
Initial commit 2021-12-26 11:47:59 -08:00