mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-29 10:42:21 +03:00
aa5dcd0518
--------- Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
1.1 KiB
1.1 KiB
The crane library can be instantiated with a specific version of nixpkgs as
follows. For more information, see the API docs for mkLib
.
# Instantiating for a specific `system`
crane.mkLib (import nixpkgs {
system = "armv7l-linux";
})
# Instantiating for cross compiling
crane.mkLib (import nixpkgs {
localSystem = "x86_64-linux";
crossSystem = "aarch64-linux";
})
The crane library can also be instantiated with a particular rust toolchain:
# For example, using rust-overlay
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
in
(crane.mkLib pkgs).overrideToolchain (p: p.rust-bin.stable.latest.default.override {
targets = [ "wasm32-wasi" ];
})
Finally, specific inputs can be overridden for the entire library via the
overrideScope
API as follows. For more information, see the API
docs for mkLib
/overrideToolchain
, or checkout the
custom-toolchain example.
(crane.mkLib pkgs).overrideScope (final: prev: {
cargo-tarpaulin = myCustomCargoTarpaulinVersion;
})