49 lines
901 B
Nix
49 lines
901 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.my.coding.langs.rust;
|
|
in
|
|
{
|
|
options.my.coding.langs.rust = {
|
|
enable = lib.mkEnableOption "rust";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
my.hm = {
|
|
home.packages = with pkgs; [
|
|
(fenix.stable.withComponents [
|
|
"cargo"
|
|
"clippy"
|
|
"rust-src"
|
|
"rustc"
|
|
"rustfmt"
|
|
"rust-analyzer"
|
|
])
|
|
evcxr # rust repl
|
|
|
|
pest-ide-tools
|
|
];
|
|
home.file.".cargo/config.toml".text = ''
|
|
[source.crates-io]
|
|
replace-with = 'rsproxy-sparse'
|
|
|
|
[source.rsproxy-sparse]
|
|
registry = "sparse+https://rsproxy.cn/index/"
|
|
|
|
[net]
|
|
git-fetch-with-cli = true
|
|
'';
|
|
programs.zsh.initContent = lib.mkAfter ''
|
|
export PATH=$PATH:$HOME/.cargo/bin
|
|
'';
|
|
};
|
|
my.persist.homeDirs = [
|
|
".cargo"
|
|
];
|
|
};
|
|
}
|