【发布时间】:2019-02-08 13:24:34
【问题描述】:
老套路
我在 nix 中有这段代码来生成 .cargo 缓存:
myVendoredSrc = pkgs.stdenv.mkDerivation {
name = "myVendoredSrc";
# i renamed .cargo into cargo to make this work
src = /home/joachim/cargo;
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
mkdir -p $out/.cargo
cp -R registry $out/.cargo
'';
};
我在 nix-build 项目中使用这个货物缓存,如下所示:
buildenv = import ./artiq-dev.nix {
extraProfile = ''
export HOME=${myVendoredSrc}
'';
# --no-compile-gateware to disable vivado build
runScript = "python -m artiq.gateware.targets.kasli -V satellite --no-compile-gateware";
};
这稍后会调用cargo build 并使用缓存而不需要连接到互联网。
在nixpkgs中有fetchcargo,见https://github.com/alexcrichton/cargo-vendor
问题
想法:弄清楚如何在我自己的 nix 文件中使用 <nixpkgs>/pkgs/build-support/rust/fetchcargo.nix...
我之前尝试过的
请不要提示我使用carnix(我尝试构建它并不能很好地工作,我还发现我不能将它用于这个项目)或buildRustPackage或buildRustCrate (同样的原因,这不能用于我正在处理的项目,因为它是一个交叉编译器设置,它是从创建多个环境变量的 python 脚本设置的)
【问题讨论】: