Emacs: Difference between revisions

imported>Tobias.bora
No edit summary
imported>Aarmn
mNo edit summary
Line 33: Line 33:


=== Emacs overlay ===
=== Emacs overlay ===
For installing one of the unstable branches of emacs, add the following lines to {{ic|/etc/nixos/configuration.nix}} (replace emacsPgtkGcc with the variant of your choice).
For installing one of the unstable branches of emacs, add the following lines to {{ic|/etc/nixos/configuration.nix}} (replace emacsPgtkNativeComp with the variant of your choice).
{{file|configuration.nix|nix|<nowiki>
{{file|configuration.nix|nix|<nowiki>
{
{
Line 47: Line 47:


   environment.systemPackages = with pkgs; [
   environment.systemPackages = with pkgs; [
     emacsPgtkGcc
     emacsPgtkNativeComp
   ];
   ];
}
}
Line 65: Line 65:


=== Packages ===
=== Packages ===
One can mix and match whether Emacs packages are installed by Nix or Emacs. This can be particularly useful for Emacs packages that need to be built, such as vterm. One way to install Emacs packages through Nix is by the following, replacing {{ic|emacsPgtkGcc}} with the variant in use:
One can mix and match whether Emacs packages are installed by Nix or Emacs. This can be particularly useful for Emacs packages that need to be built, such as vterm. One way to install Emacs packages through Nix is by the following, replacing {{ic|emacsPgtkNativeComp}} with the variant in use:


  environment.systemPackages = with pkgs;
  environment.systemPackages = with pkgs;
   [ ...
   [ ...
     ((emacsPackagesFor emacsPgtkGcc).emacsWithPackages (epkgs: [ epkgs.vterm ]))
     ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm ]))
     ...
     ...
   ];
   ];


To make the packages available to {{ic|emacsclient}}, one can do the following:
To make the packages available to {{ic|emacsclient}}, one can do the following:
  services.emacs.package = with pkgs; ((emacsPackagesFor emacsPgtkGcc).emacsWithPackages (epkgs: [ epkgs.vterm ]));
  services.emacs.package = with pkgs; ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.vterm ]));


Note that some packages may have strange characters like <code>+</code> that would be considered as a syntax error by nix. To avoid that, make sure to write it in quotes and to prepend it with the package set that you want l (even if you used <code>with epkgs; …</code>) like <code>epkgs."ido-completing-read+"</code>.
Note that some packages may have strange characters like <code>+</code> that would be considered as a syntax error by nix. To avoid that, make sure to write it in quotes and to prepend it with the package set that you want l (even if you used <code>with epkgs; …</code>) like <code>epkgs."ido-completing-read+"</code>.