Commit Graph

25 Commits

Author SHA1 Message Date
Dawid Ciężarkiewicz
0da36bc7dd
fix: cargo docs breaking in buildDepsOnly of workspaces (#410) 2023-10-03 18:59:04 -07:00
Ivan Petkov
8b4f7a4dab
various: switch to using runCommand to improve caching (#384)
For example, commands which extract a tarball should be cached (i.e
should use `runCommand` not `runCommandLocal`) because it allows builds
to download the unpacked result instead of having to write both to the
store
2023-09-04 00:33:25 +00:00
Roman Volosatovs
5291dd0aa7
feat: add support for bindeps feature (#258)
Write a `main.rs` to `src/bin/dummy` within the generated dummy source,
rather than `src/main.rs` to account for `illegalBin` test case

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
2023-03-06 17:24:21 -08:00
Ivan Petkov
d777dbc167
mkDummySrc: avoid invalidation if the source name has two hashes (#248) 2023-02-19 22:43:11 +00:00
Ivan Petkov
8b66edc016
mkDummySource: fix build invalidation regression (#195)
* When checking the original source for its name, make sure we throw
  away the string context so we don't end up actually depending on the
  original source instead of the cleaned one
2022-12-23 17:06:58 +00:00
Ivan Petkov
70fcce8db0
mkDummySrc: try to use the same output name as original source (#190) 2022-12-20 20:50:22 -08: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
c61d98aaea
mkDummySrc: properly import core (#172) 2022-11-21 01:12:39 +00:00
Ivan Petkov
2ce1a3313e
Eliminate dead code (#148) 2022-10-23 23:20:22 +00:00
Roman Volosatovs
097afacc53
mkDummySrc: support freestanding targets (#126)
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2022-10-19 02:13:38 +00:00
Ivan Petkov
22f971a126
mkDummySrc: fix handling of build scripts (#122)
* Instead of injecting our own dummy `build.rs` file, we will patch the
  `Cargo.toml` files to specify a build script in the Nix store
* This allow cargo to notice the difference (i.e. changed build script
  path) where it could not before (due to nix enforcing that all sources
  always have the same timestamp)
2022-09-28 02:05:06 +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
b9b1c322a5
mkDummySrc: fix handling when src is already filtered 2022-06-29 20:49:12 -07:00
Yusuf Bera Ertan
8f0b89244f
fix(mkDummySrc): remove IFD trigger by not checking if cargo lock path exists, the build will fail if it doesnt 2022-06-05 14:04:20 +03:00
Ivan Petkov
4f2b1c43c9
mkDummySrc: fix cache invalidation if src is flake root 2022-05-16 20:10:38 -07:00
Ivan Petkov
78359792ae
Form paths by concatenating a string suffix not a path
* Seems like Nix can get unhappy if a path fragment is evaluated too
  eagerly, giving errors like
  `error: access to absolute path '/Cargo.toml' is forbidden in pure eval mode (use '--impure' to override)`
* Changing to using string manipulation seems to resolve the issue
2022-02-13 12:50:43 -08:00
Ivan Petkov
d4b5f8abe6
chore: switch to runCommandLocal to reduce network pressure 2022-01-30 16:10:41 -08: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
1c9633f4aa
mkDummySrc: allow cargoLock location to be passed in by caller
* This can potentially allow callers to build crates which may not have
  a Cargo.lock in their source but needs to be passed in from
  _elsewhere_
2022-01-07 20:54:07 -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
1c8034c0d9
Update mkDummySrc to support cargo workspaces 2022-01-07 17:36:31 -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
55ba19ec1c
mkDummySrc: fix handling of bin targets
* First, bin targets go into `src/bin` not `bin`
* Second, the path fallback name needs a `rs` suffix
2021-12-31 19:03:06 -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