Commit Graph

59 Commits

Author SHA1 Message Date
Ivan Petkov
442a7a6152
crane-utils: bump dependencies (#609) 2024-05-04 23:12:35 +00:00
Ivan
3dda6d40ca
Fix bug with comment for inline table key (#583)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2024-04-21 04:19:57 +00:00
Ivan Petkov
1e44708c0b
chore: bump crane-utils deps (#580) 2024-04-05 20:48:03 +00:00
Ivan Petkov
f23ae17543
crane-utils: fix workspace dependency merge when it is not a table (#529) 2024-02-21 16:00:58 -08:00
Ivan Petkov
c5a3c5dac3
crane-utils: bump dependencies (#508) 2024-01-28 19:22:09 +00:00
Ivan Petkov
960d350770
vendorCargoDeps: manually splice packages to avoid cross build issues (#507)
* Source vendoring is passed as a standalone attribute to
  `mkCargoDerivation`, meaning it does not automagically get spliced
  with the correct local/cross system inputs (i.e. what would happen if
  it was a `depsBuildBuild` entry)
* To fix this we need to make sure that `vendorCargoDeps` and all of its
  transitive dependencies always use `runCommand` (and friends) from
  their `pkgsBuildBuild` equivalent. This should always be safe to do
  (even for cross-builds) since this amounts to building up a bunch of
  sources which will be read by the build system
* Unfortunately I had to manually specify `pkgsBuildBuild.whatever` in
  multiple places as I could not get things to work by messing with the
  `callPackage` definition. Perhaps we should be using
  `makeScopeWithSplicing'` instead of `makeScope` when constructing the
  library, but I couldn't get it working (and I couldn't find any decent
  docs on how to use it online) so this will make do for the time being.
2024-01-28 19:08:44 +00:00
Ivan Petkov
7814285d01
chore: bump all cargo deps (#504) 2024-01-27 03:58:59 +00:00
Roman Volosatovs
33dbb6a834
feat: support workspace lints (#481)
---------

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-12-13 17:22:10 +00:00
Ivan Petkov
159f71f4f0
craneUtils: build with rustPlatform (#431)
* This should hopefully result in fewer surprises if someone is using a
  really ancient toolchain for their code since we'll use whatever is in
  nixpkgs to build craneUtils instead
2023-10-17 00:12:57 +00:00
Ivan Petkov
117ac48319
chore: update all test deps (#420) 2023-10-13 02:57:37 +00:00
danjl1100
03e442fb3d
Replace toml dependency with toml_edit to preserve comments (#407)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-10-01 20:54:37 +00:00
Ivan Petkov
ff2e879b26
update all Cargo.locks (#364)
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/4a56ce9727a0c5478a836a0d8a8f641c5b9a3d5f' (2023-08-02)
  → 'github:NixOS/nixpkgs/5068bc8fe943bde3c446326da8d0ca9c93d5a682' (2023-08-07)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/99df4908445be37ddb2d332580365fce512a7dcf' (2023-08-03)
  → 'github:oxalica/rust-overlay/b520a3889b24aaf909e287d19d406862ced9ffc9' (2023-08-07)
2023-08-11 00:13:17 +00:00
Hung Tran
4d350bb94f
deps: update cargo-utils dependencies, should fix builds from nightly rust (#346)
---------

Co-authored-by: htran <htran@egihosting.com>
2023-06-29 16:51:22 -07:00
Ivan Petkov
54b63c8eae
chore: update all Cargo.locks (#304) 2023-04-16 21:28:36 +00:00
Ivan Petkov
0222df9e59
Fix unfortunate typo 2023-04-02 11:19:35 -07:00
Ivan Petkov
72fa29510a
chore: bump all Cargo.locks (#280) 2023-03-26 06:21:21 +00:00
Ivan Petkov
6fd78bc66a
Add path as a convenience wrapper around builtins.path (#273) 2023-03-19 20:57:15 -07:00
Roman Volosatovs
56b875b6eb
fix: target workspace dependency resolution (#265) 2023-03-19 12:47:29 -07:00
Ivan Petkov
cfb6efcfc7
Update flake.lock (#238)
flake.lock: Update

Flake lock file updates:

• Updated input 'flake-utils':
    'github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f' (2022-11-02)
  → 'github:numtide/flake-utils/3db36a8b464d0c4532ba1c7dda728f4576d6d073' (2023-02-13)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/006c3bd4dd2f5d1d2094047f307cbf9e2b73d9c5' (2023-02-02)
  → 'github:NixOS/nixpkgs/6d33e5e14fd12f99ba621683ae90cebadda753ca' (2023-02-15)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/383a4acfd11d778d5c2efcf28376cbd845eeaedf' (2023-02-03)
  → 'github:oxalica/rust-overlay/a619538647bd03e3ee1d7b947f7c11ff289b376e' (2023-02-15)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-16 02:44:59 +00:00
Ivan Petkov
7e2e5b3cc1
chore: bump all Cargo.lock files (#230) 2023-02-07 23:47:42 +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
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
1020bbe7dd Remove deprecated package bindings 2022-10-09 11:33:57 -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
06b1f7bd80
Improve stripping references to vendored sources (#120)
* Also add removeReferencesToVendoredSourcesHook
2022-09-24 23:45:56 +00:00
Ivan Petkov
dbda889c05
Replace source prefix mapping with remove-references-to (#90) 2022-08-28 01:44:07 +00: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
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
f0612a9940
configureCargoVendoredDepsHook: tweak logging
* Make it more obvious exactly which file is being used for vendoring
  (when a manifest is found) instead of just printing out the parent
  directory
2022-02-06 17:17:47 -08:00
Bernardo Meurer
91c9a89625
fix(pkgs): use zstd from pkgsBuildBuild
This allows for crane to work when `buildPlatform != hostPlatform`, such
as well `crossSystem` is set.
2022-02-08 18:23:55 -08:00
Ivan Petkov
47fbae6dc3 Add support for alternative cargo registries 2022-01-30 23:58:56 +00:00
Ivan Petkov
92d185d877
Fix some formatting 2022-01-15 19:56:46 -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
3b4e0bffe1
Rename copyCargoTargetToOutputHook to installCargoTargetDirHook
* New name should better reflect that we are _installing to the output_
  rather than copying from some location to another
2022-01-03 19:57:35 -08:00
Ivan Petkov
dc553e3853
Remove installFromCargoArtifactsHook
* This hook was never a great implementation to begin with since it
  would simply search the cargo artifacts directory for binaries and
  libraries to install
* This isn't really great since if we have multiple builds (say one with
  debug artifacts, one with release artifacts) it isn't exactly clear
  which artifacts would get installed (or which will get clobbered).
* Now that we have installFromCargoBuildLogHook we can simplify the
  options a bit and only have one main installation method. The caller
  can always provide their own if they wish
2022-01-03 14:42:59 -08:00
Ivan Petkov
f69c8a4c44
Add buildPackage for building and installing cargo packages 2022-01-03 14:32:51 -08:00
Ivan Petkov
10a60cc085
Do not copy cargo artifacts into a separate output by default
* Copying the cargo artifacts to their own separate output is a good
  idea *in theory* where each derivation produces bins/libs so that
  other things can depend on them without pulling in the cargo artifacts
  as well
* In practice, it's much more likely that a derivation will produce
  cargo artifacts (to be reused in other build/test steps) XOR produce
  the final binaries
* Therefore _not_ separating the outputs will produce less friction when
  forming dependency trees in the general path (e.g. no more forgetting
  to specify `drv.target`)
* If a caller really wants to install cargo artifacts in a separate
  output, they can easily add the customization themselves
2022-01-01 11:12:13 -08:00
Ivan Petkov
0f94b11615
Update inheritCargoArtifactsHook to be more flexible
* This allows a caller to pass in the path directly to the prepared
  target dir instead of requiring that the input be a path to its
  directory
2022-01-01 11:08:36 -08:00
Ivan Petkov
8d6d973261
Make remapSourcePathPrefixHook potentially customizable 2021-12-31 18:18:19 -08:00
Ivan Petkov
32ca849598
Make build hooks potentially customizable
* Hook functions now will accept any relevant arguments and fall back to
  our default variables if they are not provided, potentially allowing
  them to be adapted externally (without needing more configuration
  knobs on our end)
2021-12-31 17:43:56 -08:00
Ivan Petkov
64914fbc98
Remove doCompressTarget option
* Reducing the parameter surface area for good measure, zstd compression
  works pretty well and it seems redundant to support multiple ways of
  copying the target directory around
2021-12-30 20:25:33 -08:00
Ivan Petkov
2730271710
Make copyCargoTargetToOutputHook even more lazy
* Instead of always installing the hook but bailing early based on the
  configuration, we will instead only install the hook if the
  configuration requests it
2021-12-28 18:53:05 -08:00
Ivan Petkov
6cc3ea3199
Add remapSourcePathPrefixHook 2021-12-28 18:51:06 -08:00
Ivan Petkov
bf17616560
Add installFromCargoArtifactsHook 2021-12-28 17:51:51 -08:00
Ivan Petkov
dd3fa0123b
Rename inheritCargoTargetHook to inheritCargoArtifactsHook
* Hopefully the updated name should be more clear that we are inhering
  some existing cargo artifacts and NOT inheriting something like
  CARGO_BUILD_TARGET which refers to the host target being built
2021-12-28 16:48:12 -08:00
Ivan Petkov
46e6e54b3b
Update inheritCargoTargetHook to run after source patching
* This allows us to copy over the cargo artifacts as early as possible
  so that any other phases/hooks (like running clippy) can take
  advantage of the cache
* It also avoids installing the artifacts too soon (and making them
  older than the source) and having cargo invalidate them
2021-12-28 16:15:57 -08:00
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