CCE

Rust

Rust is a Programming Language Tool

CCE configuration largely lifted from Robert Krahn.

emacs-lisp
(use-package rustic
  :config
  ;; uncomment for less flashiness
  ;; (setq lsp-eldoc-hook nil)
  ;; (setq lsp-enable-symbol-highlighting nil)
  ;; (setq lsp-signature-auto-activate nil)

  (setq rustic-format-on-save t))
(provide 'cce/rust)

This Nix shell can be symlinked in to rust projects to have a working rust-analyzer and whatnot assuming I don't need one for rustup too eventually. I hope not. Maybe one for unstable? bah. direnv is used for managing this if that isn't working check the .envrc.

nix:tangle ~/nix/shells/rust.nix
let
  pkgs = import <nixpkgs> {};
in pkgs.mkShell {
  buildInputs = with pkgs; [ cargo rustc rust-analyzer rustfmt clippy ];
  nativeBuildInputs = with pkgs; [ rustc cargo gcc ];

  RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}
nix:tangle ~/nix/overrides/rustic.nix
rustic = let
  old = epkgs.rustic;
in old.overrideAttrs {
  packageRequires = old.packageRequires ++ [ epkgs.flycheck ];
};

NEXT fix this

text
Running phase: unpackPhase
unpacking source archive /nix/store/0gdz9ppp4w4s0f7sjc9ssj61rq36cb4v-source
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script  doing nothing
Running phase: buildPhase
/build /build/source
Copying files (->) and directories (=>)
  from /build/working/rustic/
  to /build/rusticKlajjW/rustic-20250310.1415
    rustic-babel.el -> rustic-babel.el
    rustic-cargo.el -> rustic-cargo.el
    rustic-clippy.el -> rustic-clippy.el
    rustic-comint.el -> rustic-comint.el
    rustic-compile.el -> rustic-compile.el
    rustic-doc.el -> rustic-doc.el
    rustic-expand.el -> rustic-expand.el
    rustic-flycheck.el -> rustic-flycheck.el
    rustic-interaction.el -> rustic-interaction.el
    rustic-lsp.el -> rustic-lsp.el
    rustic-playground.el -> rustic-playground.el
    rustic-popup.el -> rustic-popup.el
    rustic-rustfix.el -> rustic-rustfix.el
    rustic-rustfmt.el -> rustic-rustfmt.el
    rustic-spellcheck.el -> rustic-spellcheck.el
    rustic.el -> rustic.el
Created rustic-20250310.1415.tar containing:
  rustic-20250310.1415/
  rustic-20250310.1415/rustic-babel.el
  rustic-20250310.1415/rustic-cargo.el
  rustic-20250310.1415/rustic-clippy.el
  rustic-20250310.1415/rustic-comint.el
  rustic-20250310.1415/rustic-compile.el
  rustic-20250310.1415/rustic-doc.el
  rustic-20250310.1415/rustic-expand.el
  rustic-20250310.1415/rustic-flycheck.el
  rustic-20250310.1415/rustic-interaction.el
  rustic-20250310.1415/rustic-lsp.el
  rustic-20250310.1415/rustic-pkg.el
  rustic-20250310.1415/rustic-playground.el
  rustic-20250310.1415/rustic-popup.el
  rustic-20250310.1415/rustic-rustfix.el
  rustic-20250310.1415/rustic-rustfmt.el
  rustic-20250310.1415/rustic-spellcheck.el
  rustic-20250310.1415/rustic.el
/build/source
Running phase: installPhase
Parsing tar file... 
Parsing tar file...done
Parsing tar file... 
Parsing tar file...done
Extracting... \ 
Extracting...done
  INFO     Scraping 17 files for loaddefs... 
  INFO     Scraping 17 files for loaddefs...done
  GEN      rustic-autoloads.el
Checking /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415...
Compiling /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-autoloads.el...
Compiling /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-babel.el...

In rustic-babel-build-sentinel:
rustic-babel.el:158:29: Warning: assignment to free variable `result'
rustic-babel.el:159:61: Warning: reference to free variable `result'

In cargo-toml-dependencies:
rustic-babel.el:279:2: Warning: docstring wider than 80 characters

In end of data:
rustic-babel.el: Warning: the function `inheritenv-apply' is not known to be defined.
Compiling /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-cargo.el...

In rustic-cargo-init:
rustic-cargo.el:651:2: Warning: docstring wider than 80 characters

In rustic-run-shell-command:
rustic-cargo.el:745:44: Warning: Unused lexical argument `arg'
rustic-cargo.el:752:9: Warning: assignment to free variable `command'
rustic-cargo.el:753:29: Warning: reference to free variable `command'

In rustic-cargo-clean:
rustic-cargo.el:782:2: Warning: docstring wider than 80 characters

In rustic-cargo-add-missing-dependencies:
rustic-cargo.el:853:2: Warning: docstring has wrong usage of unescaped single quotes (use \=' or different quoting such as `...')
rustic-cargo.el:853:57: Warning: Unused lexical argument `arg'

In rustic-cargo-add-missing-dependencies-hook:
rustic-cargo.el:877:39: Warning: Unused lexical argument `proc'
rustic-cargo.el:877:44: Warning: Unused lexical argument `msg'

In rustic-cargo-find-missing-dependencies:
rustic-cargo.el:885:43: Warning: global/dynamic var `eglot' lacks a prefix
rustic-cargo.el:885:43: Warning: global/dynamic var `eglot' lacks a prefix

In rustic-cargo-add-missing-dependencies-eglot:
rustic-cargo.el:922:18: Warning: assignment to free variable `flymake--diagnostics-buffer-source'

In rustic-cargo-add-missing-dependencies-flycheck:
rustic-cargo.el:934:25: Warning: reference to free variable `flycheck-error-list-buffer'

In rustic-cargo-upgrade:
rustic-cargo.el:956:2: Warning: docstring wider than 80 characters

In end of data:
rustic-cargo.el:935:8: Warning: the function `flycheck-list-errors' is not known to be defined.
rustic-cargo.el:919:30: Warning: the function `flymake-diagnostics-buffer-mode' is not known to be defined.
rustic-cargo.el:911:17: Warning: the function `flymake--diagnostics-buffer-name' is not known to be defined.
rustic-cargo.el:897:46: Warning: the function `lsp-diagnostics' is not known to be defined.
rustic-cargo.el: Warning: the function `inheritenv-apply' is not known to be defined.
Compiling /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-clippy.el...

In rustic-cargo-clippy:
rustic-clippy.el:74:2: Warning: docstring wider than 80 characters

In rustic-cargo-clippy-fix:
rustic-clippy.el:113:28: Warning: Unused lexical argument `msg'
Compiling /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-comint.el...

In rustic-cargo-comint-run-mode:
rustic-comint.el:148:22: Warning: reference to free variable `poly-rustic-cargo-compilation-hostmode'
rustic-comint.el:150:23: Warning: reference to free variable `poly-rustic-cargo-comint-innermode'
rustic-comint.el:156:22: Warning: reference to free variable `rustic-cargo-comint-run-mode'

In end of data:
rustic-comint.el:156:6: Warning: the function `define-polymode' is not known to be defined.
rustic-comint.el:150:6: Warning: the function `define-innermode' is not known to be defined.
rustic-comint.el:148:6: Warning: the function `define-hostmode' is not known to be defined.
rustic-comint.el: Warning: the function `inheritenv-apply' is not known to be defined.
Compiling /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-compile.el...

In rustic-compile-goto-error-hook:
rustic-compile.el:449:2: Warning: docstring wider than 80 characters
rustic-compile.el:454:33: Warning: reference to free variable `rustic-compilation-workspace'

In end of data:
rustic-compile.el: Warning: the function `inheritenv-apply' is not known to be defined.
Compiling /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-doc.el...

In rustic-doc--install-resources:
rustic-doc.el:153:15: Warning: value from call to `f-exists?' is unused

In rustic-doc--thing-at-point:
rustic-doc.el:479:21: Warning: global/dynamic var `eglot' lacks a prefix

In end of data:
rustic-doc.el:456:30: Warning: the function `lsp:hover-contents' is not known to be defined.
rustic-doc.el:455:30: Warning: the function `lsp--send-request' is not known to be defined.
rustic-doc.el:454:30: Warning: the function `lsp--make-request' is not known to be defined.
rustic-doc.el:453:38: Warning: the function `lsp--text-document-position-params' is not known to be defined.
rustic-doc.el:439:43: Warning: the function `eglot--TextDocumentPositionParams' is not known to be defined.
rustic-doc.el:438:23: Warning: the function `eglot--current-server-or-lose' is not known to be defined.
rustic-doc.el:437:22: Warning: the function `jsonrpc-request' is not known to be defined.
rustic-doc.el: Warning: the function `inheritenv-apply' is not known to be defined.
rustic-doc.el:250:39: Warning: the function `lsp-workspace-root' is not known to be defined.
rustic-doc.el:62:9: Warning: the function `-semver-patch' is not known to be defined.
rustic-doc.el:60:9: Warning: the function `-semver-minor' is not known to be defined.
rustic-doc.el:58:9: Warning: the function `-semver-major' is not known to be defined.
Compiling /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-expand.el...
Compiling /nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-flycheck.el...

Error: file-missing ("Cannot open load file" "No such file or directory" "flycheck")
  require(flycheck)
  byte-compile-file-form-require((require 'flycheck))
  byte-compile-file-form((require 'flycheck))
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_50>((require 'flycheck))
  byte-compile-recurse-toplevel((require 'flycheck) #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_50>)
  byte-compile-toplevel-file-form((require 'flycheck))
  #f(compiled-function () #<bytecode 0xa8c4d26b44b4ab>)()
  bytecomp--displaying-warnings(#f(compiled-function () #<bytecode 0xa8c4d26b44b4ab>))
  byte-compile-from-buffer(#<buffer  *Compiler Input*>)
  byte-compile-file("/nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-flycheck.el")
  byte-recompile-file("/nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415/rustic-flycheck.el" t 0)
  #f(compiled-function () #<bytecode -0x1d55d648baf5271b>)()
  bytecomp--displaying-warnings(#f(compiled-function () #<bytecode -0x1d55d648baf5271b>))
  byte-recompile-directory("/nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415" 0 t)
  package--compile(#s(package-desc :name rustic :version (20250310 1415) :summary "Rust development environment" :reqs ((emacs (28 2)) (rust-mode (1 0 6)) (dash (2 13 0)) (f (0 18 2)) (let-alist (1 0 4)) (markdown-mode (2 3)) (project (0 3 0)) (s (1 10 0)) (spinner (1 7 3)) (xterm-color (1 6))) :kind nil :archive nil :dir "/nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa/rustic-20250310.1415" :extras ((:keywords "languages") (:commit . "22a5ef8bfd5a34ced945c2722938eb29632371d4")) :signed nil))
  package-unpack(#s(package-desc :name rustic :version (20250310 1415) :summary "Rust development environment" :reqs ((emacs (28 2)) (rust-mode (1 0 6)) (dash (2 13 0)) (f (0 18 2)) (let-alist (1 0 4)) (markdown-mode (2 3)) (project (0 3 0)) (s (1 10 0)) (spinner (1 7 3)) (xterm-color (1 6))) :kind tar :archive nil :dir nil :extras ((:keywords "languages") (:commit . "22a5ef8bfd5a34ced945c2722938eb29632371d4")) :signed nil))
  (let ((pkg-desc (if (derived-mode-p 'tar-mode) (package-tar-file-info) (package-buffer-info)))) (package-unpack pkg-desc) pkg-desc)
  elpa2nix-install-from-buffer()
  (progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-tar (progn (tar-mode))) (elpa2nix-install-from-buffer))
  (unwind-protect (progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-tar (progn (tar-mode))) (elpa2nix-install-from-buffer)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-tar (progn (tar-mode))) (elpa2nix-install-from-buffer)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-tar (progn (tar-mode))) (elpa2nix-install-from-buffer)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (let ((is-tar (string-match "\\.tar\\'" file))) (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-tar (progn (tar-mode))) (elpa2nix-install-from-buffer)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))
  elpa2nix-install-file("/build/packages/rustic-20250310.1415.tar")
  (progn (setq package-user-dir elpa) (elpa2nix-install-file archive))
  (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive)))
  (if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive))))
  (let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive)))))
  (if (consp x1) (let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive))))))
  (let* ((x0 (car-safe command-line-args-left)) (x1 (cdr-safe command-line-args-left))) (if (consp x1) (let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive)))))))
  (if (consp command-line-args-left) (let* ((x0 (car-safe command-line-args-left)) (x1 (cdr-safe command-line-args-left))) (if (consp x1) (let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive))))))))
  elpa2nix-install-package()
  command-line-1(("-l" "/nix/store/cb1mazp6yhvrhlwhr231l8z32s8ys2wh-elpa2nix.el" "-f" "elpa2nix-install-package" "/build/packages/rustic-20250310.1415.tar" "/nix/store/mf30wyckxmw9a3cncmv815qs6q2r2s6q-emacs-rustic-20250310.1415/share/emacs/site-lisp/elpa"))
  command-line()
  normal-top-level()
Cannot open load file: No such file or directory  flycheck