* i.e. if we neither set localSystem/crossSystem, nor add overlays, we
can directly utilize `nixpkgs.legacyPackages.${system}` directly and
avoid re-evaluating nixpkgs an additional time
Crane is one of the most popular libraries on FlakeHub, but it won't appear as "featured" on the homepage because there is no description. I thought I'd help fix that if you want it!
* crates.io uses the sparse registry by default, and trying to
explicitly register a sparse registry for it results in errors
* Also set nixConfig to include binary cache
[Trunk](https://trunkrs.dev) is a tool that allow you to build web apps
using Rust and webassembly, including compiling scss, and distributing
other assets.
Adds `craneLib.buildTrunkPackage`, a function that builds a Trunk
project returning a directory with the resulting dist files for that
project
---------
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
* 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>
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.
* 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
* 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`
* `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