Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emacsPackagesNg.racer-mode: fix default value for RUST_SRC_PATH #54194

Merged
merged 1 commit into from Jan 28, 2019

Conversation

vanzef
Copy link
Contributor

@vanzef vanzef commented Jan 17, 2019

Motivation for this change

racer-mode explicitly passes $RUST_SRC_PATH to racer with default value equals to /usr/local/src/rust/src.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@infinisil
Copy link
Member

infinisil commented Jan 26, 2019

I'm not sure if this is a good idea because the closure size of racer will be a lot higher, and lots of people probably aren't using nixpkgs' rust anyways, so the source won't be accurate. Can you do a closure size measurement?

@vanzef
Copy link
Contributor Author

vanzef commented Jan 27, 2019

lots of people probably aren't using nixpkgs' rust anyways, so the source won't be accurate.

I don't think this would be a problem -- /usr/local/src/rust/src is a fallback path and normally the proper path would be obtained with rustc --print sysroot which, I guess, works perfectly fine for those who installed rustc via rustup despite the hardcoded path in racer-mode

(defcustom racer-rust-src-path
  (or
   (getenv "RUST_SRC_PATH")
   (when (executable-find "rustc")
     (let* ((sysroot (s-trim-right
                      (shell-command-to-string
                       (format "%s --print sysroot" (executable-find "rustc")))))
            (src-path (f-join sysroot "lib/rustlib/src/rust/src")))
       (when (file-exists-p src-path)
         src-path)
       src-path))
   "/usr/local/src/rust/src")

Can you do a closure size measurement?

/nix/store/4fqbdg0d5jagndzkjhns6j6kppwzv08a-emacs-racer-20181023.1604     385828576
/nix/store/xqdaf1zm726h1031zb6zdv9sa9ns74q5-emacs-racer-20181023.1604     641303584

The former is the nix path-info -S for ./result without the patch and the latter -- with one.

@infinisil
Copy link
Member

Hmm I see. Alright I think this is fine then, even though it does increase closure size considerably. Currently probably most people won't take advantage of this, as everybody either uses rustup or has RUST_SRC_PATH set, but for everybody that installs it for the first time, this will be a nice change.

@infinisil infinisil merged commit e47fcae into NixOS:master Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants