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

View file

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