Emacs: Difference between revisions

DoggoBit (talk | contribs)
m remove nl's
Warn about double-listing emacs-pgtk.
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{application infobox
{{application infobox
   |title=GNU Emacs
   |name=GNU Emacs
   |image=EmacsIcon.svg
   |image=EmacsIcon.svg
   |type=Text Editor
   |type=Text Editor
Line 78: Line 78:
==== Installing Packages ====
==== Installing Packages ====
{{Note|Emacs, much like NixOS can rebuild and re-fetch all of its packages based on its initialization file alone, if one chooses to use an extension called "use-package". Such a configuration file can be version controlled and used in all compatible operating systems.}}
{{Note|Emacs, much like NixOS can rebuild and re-fetch all of its packages based on its initialization file alone, if one chooses to use an extension called "use-package". Such a configuration file can be version controlled and used in all compatible operating systems.}}
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:<syntaxhighlight lang="nix">
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|emacs-pgtk}} with the variant in use:<syntaxhighlight lang="nix">
environment.systemPackages = with pkgs;
environment.systemPackages = with pkgs;
[ ...
[ ...
   ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (
   ((emacsPackagesFor emacs-pgtk).emacsWithPackages (
     epkgs: [ epkgs.vterm ]
     epkgs: [ epkgs.vterm ]
   ))
   ))
Line 89: Line 89:
# To make the packages available to emacsclient, one can do the following:
# To make the packages available to emacsclient, one can do the following:
services.emacs.package = with pkgs; (
services.emacs.package = with pkgs; (
   (emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (
   (emacsPackagesFor emacs-pgtk).emacsWithPackages (
     epkgs: [ epkgs.vterm ]
     epkgs: [ epkgs.vterm ]
   )
   )
Line 103: Line 103:




</syntaxhighlight>
</syntaxhighlight>Note that if the expression <code>(emacsPackagesFor emacs-pgtk)</code> is present, <code>emacs-pgtk</code> need not be listed separately in the list <code>environment.systemPackages</code>. Indeed, if one does that, <code>nixos-rebuild</code> will warn about link collisions when the configuration is rebuilt.


==== Tree-sitter ====
==== Tree-sitter ====
Line 205: Line 205:
   environment.systemPackages = with pkgs;
   environment.systemPackages = with pkgs;
     [ ...
     [ ...
       ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [  
       ((emacsPackagesFor emacs-pgtk).emacsWithPackages (epkgs: [  
           epkgs.vterm  
           epkgs.vterm  
           (callPackage ./lambda-line.nix {
           (callPackage ./lambda-line.nix {