Get Spacemacs/Emacs GUI version to recognize nix

I do my development in a Nix shell (create a default.nix file in my project root and then run nix-shell . to give me a shell with access to the project dependencies).

Spacemacs is my main editor, but when I try to run the GUI version via emacs & I don't have access to the programs in my nix-shell (if I were in a Ruby on Rails project for example, and Ruby was declared as a dependency in my default.nix , I would have no syntax highlighting in Spacemacs because the GUI version of Emacs doesn't see my Nix-shell dependencies). If I run :!which ruby , it can't even find the which command.

Right now, I'm running spacemacs via emacs -nw and just using it from the console, but I would really like to be able to use the GUI editor and get the full colorschemes available rather than being limited to the ones that look nice in 256 color mode. It's also quicker for me to switch between the terminal and the editor than between tmux panes or terminal splits to get to my CLI editor.

with import <nixpkgs> {}; {
  cannyFreeRadicalEnv = stdenv.mkDerivation rec {
    name = "rails-project-env";
    version = "0.1";
    src = ./.;
    buildInputs = [
        stdenv
        ruby_2_2_2
        bundler
        zlib
        postgresql94
        sqlite
        zsh
        git
        nodejs-0_12
    ];
  };
}

I was able to fix this issue by running space emacs in daemon mode. https://www.emacswiki.org/emacs/EmacsAsDaemon

in the directory with default.nix: nix-shell . emacs --daemon emacsclient -c -a emacs nix-shell . emacs --daemon emacsclient -c -a emacs


You can run your GUI Emacs as

setsid nix-shell . --command "emacs" &> /dev/null

Also see discussion about nix-shell integration to flycheck and ghc-mode .


Tip: you can use alias for this in your .zshrc or .bashrc

run-nix-emacs () {
  setsid nix-shell . --command "emacs" &> /dev/null
}

alias ne='run-nix-emacs'
链接地址: http://www.djcxy.com/p/88368.html

上一篇: 应用程序在Segue for iOS 9 + Xcode 7上崩溃整个设备

下一篇: 获取Spacemacs / Emacs GUI版本以识别nix