feat: add support for custom rust toolchains compatible with rustup
This commit is contained in:
+15
-1
@@ -25,10 +25,17 @@
|
||||
}: let
|
||||
cfg = config.krantz.rust;
|
||||
|
||||
craneLib = inputs.crane.mkLib pkgs;
|
||||
src = cfg.srcFiltered;
|
||||
manifest = (lib.importTOML "${src}/Cargo.toml").package;
|
||||
|
||||
craneLib =
|
||||
if builtins.pathExists cfg.srcToolchain
|
||||
then
|
||||
(inputs.crane.mkLib (pkgs.extend inputs.rust-overlay.overlays.default)).overrideToolchain (
|
||||
p: p.rust-bin.fromRustupToolchainFile cfg.srcToolchain
|
||||
)
|
||||
else inputs.crane.mkLib pkgs;
|
||||
|
||||
buildInputs = cfg.runtimeDeps;
|
||||
|
||||
# build dependencies
|
||||
@@ -55,6 +62,13 @@
|
||||
defaultText = lib.literalExpression "config.krantz.rust.craneLib cfg.src";
|
||||
example = lib.literalExpression "./.";
|
||||
};
|
||||
srcToolchain = lib.mkOption {
|
||||
description = "A path to the rust-toolchain(.toml) file for the repo. Will use the toolchain from nixpkgs if the file does not exist.";
|
||||
type = lib.types.path;
|
||||
default = "${cfg.src}/rust-toolchain.toml";
|
||||
defaultText = lib.literalExpression "cfg.src + \"/rust-toolchain.toml\"";
|
||||
example = lib.literalExpression "./rust-toolchain";
|
||||
};
|
||||
|
||||
runtimeDeps = lib.mkOption {
|
||||
description = "Packages needed for the app to run.";
|
||||
|
||||
Reference in New Issue
Block a user