feat: add support for custom rust toolchains compatible with rustup
This commit is contained in:
Generated
+21
@@ -262,9 +262,30 @@
|
||||
"crane": "crane",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1780197589,
|
||||
"narHash": "sha256-FVCr2Ij/jKf59a4LW481eeOF6rJRreOBrVgW/aUBTrw=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "21632e942d89bf1cce4e5a63d7e58a215a0cbfcc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
|
||||
crane.url = "github:ipetkov/crane";
|
||||
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
cadquery = {
|
||||
url = "github:vinszent/cq-flake";
|
||||
# unfortunately dependencies are out of date so this needs it's own nixpkgs
|
||||
|
||||
+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