fix: don't error if src and srcToolchain is not defined. Just default to nixpkgs toolchain instead.

This commit is contained in:
2026-06-01 16:11:50 -05:00
parent 3fefb3570a
commit 0c581ed8b0
+3 -2
View File
@@ -52,7 +52,8 @@
src = lib.mkOption { src = lib.mkOption {
description = "The path to the root of the crate."; description = "The path to the root of the crate.";
type = lib.types.path; type = lib.types.nullOr lib.types.path;
default = null;
example = lib.literalExpression "./."; example = lib.literalExpression "./.";
}; };
srcFiltered = lib.mkOption { srcFiltered = lib.mkOption {
@@ -65,7 +66,7 @@
srcToolchain = lib.mkOption { 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."; 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; type = lib.types.path;
default = "${cfg.src}/rust-toolchain.toml"; default = "${if cfg.src != null then cfg.src else "/dev/null"}/rust-toolchain.toml";
defaultText = lib.literalExpression "cfg.src + \"/rust-toolchain.toml\""; defaultText = lib.literalExpression "cfg.src + \"/rust-toolchain.toml\"";
example = lib.literalExpression "./rust-toolchain"; example = lib.literalExpression "./rust-toolchain";
}; };