1
0
Fork 0

pkgsets/emacs/rust: use rust overlay from pkgsets

This commit is contained in:
Kevin Baensch 2020-06-12 09:10:09 +02:00
parent f0202c96d9
commit 5c266bc532
Signed by: derped
GPG Key ID: C0F1D326C7626543
1 changed files with 9 additions and 5 deletions

View File

@ -2,7 +2,12 @@
with lib;
mkIf (elem "emacs::rust" config.machine.pkgs) {
let
rustEnv = pkgs.symlinkJoin {
name = "rustEnv";
paths = config.machine.pkgsets.rustpkgs.pkgwrap;
};
in mkIf (elem "emacs::rust" config.machine.pkgs) {
programs.emacs.init.usePackage.rust-mode = {
enable = true;
hook = [ ''(rust-mode . (lambda () (cargo-minor-mode)))'' ]
@ -15,7 +20,7 @@ mkIf (elem "emacs::rust" config.machine.pkgs) {
"<tab>" = "company-indent-or-complete-common";
};};
config = ''
(setq rust-rustfmt-bin "${pkgs.rustfmt}/bin/rustfmt")
(setq rust-rustfmt-bin "${rustEnv}/bin/rustfmt")
(setq rust-format-on-save t)
'';
};
@ -33,9 +38,8 @@ mkIf (elem "emacs::rust" config.machine.pkgs) {
] ++ optional (elem "emacs::company" config.machine.pkgs) ''(racer-mode . (lambda () (company-mode)))'';
config = ''
(setq racer-rust-src-path (concat (getenv "HOME")
"/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/"))
(setq racer-cmd "${pkgs.rustracer}/bin/racer")
(setq racer-rust-src-path "${rustEnv}/lib/rustlib/src/rust/src")
(setq racer-cmd "${rustEnv}/bin/racer")
'';
};
}