Commit Graph

60 Commits

Author SHA1 Message Date
Ivan Petkov
7b80c23eb5
Update configureCargoVendoredDepsHook to use $CARGO_HOME/config.toml
* Rather than clobbering the project's .cargo/config.toml file (if it
  exists), the setup hook will update the base configuration used in
  $CARGO_HOME/config.toml
* This potentially allows for projects who know what they are doing to
  more easily replace their own sources, while falling back to our
  configuration
2021-12-28 16:05:20 -08:00
Ivan Petkov
c10fd1c8b1
Set CARGO_HOME in configureCargoCommonVarsHook
* This will define CARGO_HOME to $PWD/.cargo-home to ensure that cargo
  never tries to look for a missing HOME directory as it's default
  location
* The hook is also added to `postPatchHooks` (instead of
  `preConfigureHooks`) to ensure that it runs before all other
  configuration-related hooks
2021-12-28 16:00:50 -08:00
Ivan Petkov
65b984b4aa
Rename doCopyTarget to doCopyTargetToOutput
* The intention is to make it more clear that this flag controls copying
  the target directory so that *other* derivations can use it, and DOES
  NOT control whether we use an *existing* target directory from another
  derivation
2021-12-28 15:19:10 -08:00
Ivan Petkov
b8d083cd7e
Implement automatically setting up a vendor dir from source
* If the source root contains a Cargo.lock file it will be used to
  create a vendor directory
* Otherwise a (descriptive) error will be thrown describing how to
  remediate
* The caller can, of course, manually specify their own `cargoVendorDir`
  which will skip the default vendoring
2021-12-28 15:15:10 -08:00
Ivan Petkov
5abd4f6054
Implement compressing cargo target directory 2021-12-26 20:25:36 -08:00
Ivan Petkov
edcb983805
Change doCopyTarget to always imply a separate output
* We can simplify the configuration by removing the
  `doCopyTargetToSeparateOutput` parameter
* If a caller wants to copy target artifacts into any other output, it
  is pretty trivial for them to add their own logic for it
2021-12-26 20:11:22 -08:00
Ivan Petkov
2d9788eb8b
Add copyCargoTargetToOutputHook 2021-12-26 18:06:19 -08:00
Ivan Petkov
c2d7d083d5
Add configureCargoCommonVarsHook 2021-12-26 17:17: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