emacs-guix.texi 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263
  1. \input texinfo
  2. @setfilename emacs-guix.info
  3. @documentencoding UTF-8
  4. @settitle Emacs-Guix Reference Manual
  5. @copying
  6. This document describes Emacs-Guix, the Emacs interface for the
  7. @uref{https://www.gnu.org/software/guix/, GNU Guix} package manager.
  8. @quotation
  9. Copyright @copyright{} 2014-2017 Alex Kost
  10. Permission is granted to copy, distribute and/or modify this document
  11. under the terms of the GNU Free Documentation License, Version 1.3
  12. or any later version published by the Free Software Foundation;
  13. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
  14. A copy of the license is available at
  15. @url{http://www.gnu.org/licenses/fdl.html}.
  16. @end quotation
  17. @end copying
  18. @dircategory Emacs
  19. @direntry
  20. * Emacs-Guix: (Emacs-Guix). Emacs interface for GNU Guix
  21. @end direntry
  22. @titlepage
  23. @title Emacs-Guix User Manual
  24. @author Alex Kost
  25. @page
  26. @vskip 0pt plus 1filll
  27. @insertcopying
  28. @end titlepage
  29. @contents
  30. @c ----------------------------------------------------------------
  31. @node Top
  32. @top Emacs-Guix
  33. @insertcopying
  34. @menu
  35. * Introduction:: Quick overview.
  36. * Installation:: Installing Emacs-Guix.
  37. * Package Management:: Managing packages and profile generations.
  38. * Package Licenses:: Interface for licenses of packages.
  39. * Package Locations:: Interface for locations of package source files.
  40. * Popup Interface:: Magit-like interface for guix commands.
  41. * Prettify Mode:: Abbreviating @file{/gnu/store/@dots{}} file names.
  42. * Build Log Mode:: Highlighting Guix build logs.
  43. * Completions:: Completing @command{guix} shell command.
  44. * Development:: Highlighting and tools for Guix code.
  45. * Hydra:: Interface for the Guix build farm.
  46. * List/Info Interface:: Describing ``list''/''info'' buffers.
  47. * Configuration:: Configuring Emacs-Guix.
  48. * Help:: Help commands.
  49. Indexes
  50. * Concept Index:: Concepts.
  51. * Command Index:: Commands and functions.
  52. * Variable Index:: Variables.
  53. @end menu
  54. @c ----------------------------------------------------------------
  55. @node Introduction
  56. @chapter Introduction
  57. Emacs-Guix (also known as ``guix.el'') provides various interfaces and
  58. tools related to the GNU Guix package manager.
  59. @findex guix-about
  60. Call @kbd{M-x guix-about} to see a splash screen similar to
  61. @kbd{M-x@tie{}about-emacs}.
  62. Call @kbd{M-x guix-help} to get a summary of all the available
  63. commands (@pxref{Help}).
  64. In short, Emacs-Guix provides the following features:
  65. @itemize @bullet
  66. @item
  67. Interfaces for:
  68. @itemize @minus
  69. @item profiles (@pxref{Profiles})
  70. @item profile generations (@pxref{Generations})
  71. @item packages (@pxref{Packages})
  72. @item package licenses (@pxref{Package Licenses})
  73. @item package locations (@pxref{Package Locations})
  74. @item @uref{https://hydra.gnu.org, Hydra build farm} (@pxref{Hydra})
  75. @end itemize
  76. @item
  77. Magit-like popup interface for all guix shell commands
  78. (@pxref{Popup Interface}).
  79. @item
  80. Modes to view logs of package builds (@pxref{Build Log Mode}).
  81. @item
  82. Minor mode to ``prettify'' store file names (@pxref{Prettify Mode}).
  83. @item
  84. Shell completions for all guix commands and options
  85. (@pxref{Completions}).
  86. @item
  87. Minor mode with additional functionality for @code{scheme-mode} to
  88. work with Guix Scheme files (@pxref{Development}).
  89. @end itemize
  90. @c ----------------------------------------------------------------
  91. @node Installation
  92. @chapter Installation
  93. @cindex installation
  94. There are several ways to install Emacs-Guix:
  95. @itemize
  96. @item Installing using GNU Guix
  97. @example
  98. $ guix package -i emacs-guix
  99. @end example
  100. @item Installing from @uref{http://melpa.org/, MELPA}
  101. @item Using from a git checkout
  102. @end itemize
  103. For the first 2 options, you are all set, so you can skip this
  104. chapter. If you want to use Emacs-Guix from a git checkout, read
  105. further.
  106. @menu
  107. * Requirements:: Required and optional dependencies.
  108. * Using from Git:: Using without installation.
  109. @end menu
  110. @node Requirements
  111. @section Requirements
  112. Emacs-Guix depends on the following packages:
  113. @itemize
  114. @item
  115. @uref{http://www.gnu.org/software/emacs/, GNU Emacs}, version 24.3 or
  116. later.
  117. @item
  118. @uref{http://www.gnu.org/software/guix/, GNU Guix}, version 0.11.0 or
  119. later. You need it for the most features of Emacs-Guix, but not for
  120. all: Guix is not needed if you want to look at log files (@pxref{Build
  121. Log Mode}), to ``prettify'' store file names (@pxref{Prettify Mode}),
  122. or to receive some info from Hydra (@pxref{Hydra}).
  123. @item
  124. @uref{http://nongnu.org/geiser/, Geiser}, version 0.8 or later. It is
  125. used to communicate with the Guix daemon, and to receive various info
  126. from the Guix Guile code. So without Geiser, you can use the same
  127. features as without Guix.
  128. @item
  129. @uref{https://github.com/magnars/dash.el, dash library}, version
  130. 2.11.0 or later.
  131. @item
  132. @uref{https://github.com/alezost/bui.el, BUI library}, version 1.1.0
  133. or later. It is used to define various ``list''/``info'' interfaces
  134. (to display packages, generations, licenses, etc.).
  135. @item
  136. @uref{https://github.com/magit/magit, magit-popup library}. You
  137. already have this library if you use Magit 2.1.0 or later. This
  138. library is required only for @kbd{M-x@tie{}guix} command (@pxref{Popup
  139. Interface}).
  140. @end itemize
  141. To sum up, most likely, you'll need all the above dependencies except
  142. maybe @code{magit-popup}.
  143. @node Using from Git
  144. @section Using from Git
  145. You can use Emacs-Guix directly from a git checkout without any
  146. installation.
  147. At first, you need to clone the repository and to run
  148. @code{autogen.sh} script (it's just a wrapper for @code{autoreconf}
  149. command). If you don't have all dependencies installed, you may use
  150. @file{guix.scm} file to make an environment to build Emacs-Guix
  151. (@pxref{Invoking guix environment,,, guix, The GNU Guix Reference
  152. Manual}):
  153. @example
  154. $ git clone https://github.com/alezost/guix.el.git
  155. $ cd guix.el
  156. $ guix environment --pure --load=guix.scm
  157. $ ./autogen.sh
  158. @end example
  159. Now configure and make it (this will compile all Emacs-Lisp and Scheme
  160. files, and will generate @file{guix-autoloads.el} file):
  161. @example
  162. $ ./configure
  163. $ make
  164. @end example
  165. Now all you need, is to add @file{elisp} directory to the Emacs
  166. @code{load-path} and to load the generated autoloads. This can be
  167. done by adding the following code into your Emacs init file
  168. (@pxref{Init File,,, emacs, The GNU Emacs Manual}):
  169. @example
  170. (add-to-list 'load-path "/path/to/emacs-guix/elisp")
  171. (require 'guix-autoloads nil t)
  172. @end example
  173. Now, if you start Emacs, all @kbd{M-x guix-@dots{}} commands should
  174. become available.
  175. @c ----------------------------------------------------------------
  176. @node Package Management
  177. @chapter Package Management
  178. Emacs-Guix provides a visual interface for routine package management
  179. tasks, pretty much like the @command{guix package} command
  180. (@pxref{Invoking guix package,,, guix, The GNU Guix Reference
  181. Manual}). Specifically, it makes it easy to:
  182. @itemize
  183. @item browse and display packages and generations;
  184. @item search, install, upgrade and remove packages;
  185. @item display packages from previous generations;
  186. @item do some other useful things.
  187. @end itemize
  188. @menu
  189. * Packages:: Interface for packages.
  190. * Profiles:: Interface for profiles.
  191. * Generations:: Interface for profile generations.
  192. * Miscellaneous Commands:: Other related commands.
  193. @end menu
  194. @node Packages
  195. @section Packages
  196. @cindex packages
  197. There are multiple commands to display a list of Guix packages. You
  198. can either perform some actions in such ``package-list'' buffer, or
  199. ``describe'' package(s) with @key{RET} and do what you need in
  200. ``info'' buffer.
  201. @menu
  202. * Package Commands:: @kbd{M-x guix-@dots{}} to show packages.
  203. * Package Keys:: Key bindings in ``package-list'' buffer.
  204. @end menu
  205. @node Package Commands
  206. @subsection Package Commands
  207. @vindex guix-current-profile
  208. @findex guix-set-current-profile
  209. All commands for displaying packages use the current profile
  210. (@code{guix-current-profile} variable), which can be changed with
  211. @kbd{M-x@tie{}guix-set-current-profile}. Alternatively, if you call
  212. any of the following commands with a prefix argument (@kbd{C-u}), you
  213. will be prompted for a profile just for that command.
  214. @table @kbd
  215. @findex guix-all-available-packages
  216. @item M-x guix-all-available-packages
  217. @findex guix-newest-available-packages
  218. @itemx M-x guix-newest-available-packages
  219. Display all/newest available packages.
  220. @findex guix-installed-packages
  221. @item M-x guix-installed-packages
  222. @findex guix-installed-user-packages
  223. @itemx M-x guix-installed-user-packages
  224. @findex guix-installed-system-packages
  225. @itemx M-x guix-installed-system-packages
  226. Display installed packages. As explained above, @kbd{M-x
  227. guix-installed-packages} uses an arbitrary profile that you can specify,
  228. while the other commands display packages installed in 2 special
  229. profiles: @file{~/.guix-profile} and @file{/run/current-system/profile}
  230. (only on GuixSD).
  231. @findex guix-obsolete-packages
  232. @item M-x guix-obsolete-packages
  233. Display obsolete packages (the packages that are installed in a profile
  234. but cannot be found among available packages).
  235. @findex guix-packages-by-name
  236. @item M-x guix-packages-by-name
  237. Display package(s) with the specified name.
  238. @findex guix-packages-by-license
  239. @item M-x guix-packages-by-license
  240. Display package(s) with the specified license.
  241. @findex guix-packages-by-location
  242. @item M-x guix-packages-by-location
  243. Display package(s) located in the specified file. These files usually
  244. have the following form: @file{gnu/packages/emacs.scm}, but don't type
  245. them manually! Press @key{TAB} to complete the file name.
  246. @findex guix-package-from-file
  247. @item M-x guix-package-from-file
  248. Display package that the code within the specified file evaluates to.
  249. @xref{Invoking guix package, @code{--install-from-file},, guix, The
  250. GNU Guix Reference Manual}, for an example of what such a file may
  251. look like.
  252. @findex guix-packages-from-system-config-file
  253. @item M-x guix-packages-from-system-config-file
  254. Display packages from the specified file with @code{operating-system}
  255. declaration (@pxref{Using the Configuration System,,, guix, The GNU
  256. Guix Reference Manual}).
  257. @findex guix-search-by-regexp
  258. @item M-x guix-search-by-regexp
  259. Search for packages by a specified regexp. By default ``name'',
  260. ``synopsis'' and ``description'' of the packages will be searched. This
  261. can be changed by modifying @code{guix-package-search-params} variable.
  262. @findex guix-search-by-name
  263. @item M-x guix-search-by-name
  264. Search for packages with names matching a specified regexp. This
  265. command is the same as @code{guix-search-by-regexp}, except only a
  266. package ``name'' is searched.
  267. @end table
  268. @vindex guix-package-list-type
  269. By default, these commands display each package @strong{output} on a
  270. separate line. If you prefer to see a list of packages---i.e., a list
  271. with a @strong{package} per line, use the following setting:
  272. @example
  273. (setq guix-package-list-type 'package)
  274. @end example
  275. @node Package Keys
  276. @subsection Package Keys
  277. Along with the general ``list'' keys (@pxref{List buffer}), a
  278. ``package-list'' buffer additionally provides the following key
  279. bindings:
  280. @table @kbd
  281. @item i
  282. Mark the current package for installation.
  283. @item d
  284. Mark the current package for deletion.
  285. @item U
  286. Mark the current package for upgrading.
  287. @item ^
  288. Mark all obsolete packages for upgrading (with prefix, mark all
  289. installed packages for upgrading).
  290. @item x
  291. Execute actions on the marked packages.
  292. @item e
  293. Edit the definition of the current package (go to its location). This
  294. is similar to @command{guix edit} command (@pxref{Invoking guix
  295. edit,,, guix, The GNU Guix Reference Manual}), but for opening a
  296. package recipe in the current Emacs instance.
  297. @item G
  298. @cindex graph
  299. Show graph for the current package (@pxref{Graph Configuration}).
  300. @item z
  301. Show package size (@pxref{Invoking guix size,,, guix, The GNU Guix
  302. Reference Manual}).
  303. @item L
  304. Lint the current package (@pxref{Invoking guix lint,,, guix, The GNU
  305. Guix Reference Manual}). With prefix argument, you'll be prompted for
  306. checker names.
  307. @item B
  308. Display latest builds of the current package (@pxref{Hydra}).
  309. @end table
  310. @node Profiles
  311. @section Profiles
  312. @cindex profiles
  313. @findex guix-profiles
  314. @vindex guix-profiles
  315. You can keep track of your Guix profiles with @kbd{M-x guix-profiles}
  316. command. By default, it displays only @file{~/.guix-profile} and a
  317. system profile (on GuixSD). But if you manage multiple profiles, you
  318. can add them by setting @code{guix-profiles} variable, for example,
  319. like this:
  320. @example
  321. (with-eval-after-load 'guix-ui-profile
  322. (setq guix-profiles
  323. (append '("/path/to/my-profile1"
  324. "/path/to/my-profile2")
  325. guix-profiles)))
  326. @end example
  327. Along with the general ``list'' keys (@pxref{List buffer}), a
  328. ``profile-list'' buffer additionally provides the following
  329. bindings:
  330. @table @kbd
  331. @item P
  332. Display packages installed in profile at point.
  333. @item G
  334. Display generations of profile at point.
  335. @item c
  336. Make profile at point the current profile for the package commands
  337. (@pxref{Packages}).
  338. @end table
  339. @node Generations
  340. @section Generations
  341. @cindex generations
  342. Each Guix profile may have generations and Emacs-Guix allows you to
  343. display these generations, to switch to a particular generation, to
  344. look at the packages installed in it and to compare generations.
  345. @menu
  346. * Generation Commands:: @kbd{M-x guix-@dots{}} to show generations.
  347. * Generation Keys:: Key bindings in ``generation-list'' buffer.
  348. @end menu
  349. @node Generation Commands
  350. @subsection Generation Commands
  351. As with commands for displaying packages (@pxref{Package Commands}),
  352. commands for displaying generations use the current profile and can be
  353. called with a prefix argument.
  354. @table @kbd
  355. @findex guix-generations
  356. @item M-x guix-generations
  357. List all the generations.
  358. @findex guix-last-generations
  359. @item M-x guix-last-generations
  360. List the @var{N} last generations. You will be prompted for the number
  361. of generations.
  362. @findex guix-generations-by-time
  363. @item M-x guix-generations-by-time
  364. List generations matching time period. You will be prompted for the
  365. period using Org mode time prompt based on Emacs calendar (@pxref{The
  366. date/time prompt,,, org, The Org Manual}).
  367. @end table
  368. Analogously, on GuixSD you can also display system generations:
  369. @table @kbd
  370. @findex guix-system-generations
  371. @item M-x guix-system-generations
  372. @findex guix-last-system-generations
  373. @item M-x guix-last-system-generations
  374. @findex guix-system-generations-by-time
  375. @item M-x guix-system-generations-by-time
  376. @end table
  377. @node Generation Keys
  378. @subsection Generation Keys
  379. Along with the general ``list'' keys (@pxref{List buffer}), a
  380. ``generation-list'' buffer additionally provides the following
  381. bindings:
  382. @table @kbd
  383. @item P
  384. List packages installed in the current generation.
  385. @item c
  386. Switch profile to the current generation.
  387. @item d
  388. Mark the current generation for deletion (with prefix, mark all
  389. generations).
  390. @item x
  391. Execute actions on the marked generations---i.e., delete generations.
  392. @item e
  393. Run Ediff (@pxref{Top,,, ediff, The Ediff Manual}) on package outputs
  394. installed in the 2 marked generations. With prefix argument, run Ediff
  395. on manifests of the marked generations.
  396. @item =
  397. Run Diff (@pxref{Diff Mode,,, emacs, The GNU Emacs Manual}) on package
  398. outputs installed in the 2 marked generations. With prefix argument,
  399. run Diff on manifests of the marked generations.
  400. @item +
  401. List package outputs added to the latest marked generation comparing
  402. with another marked generation.
  403. @item -
  404. List package outputs removed from the latest marked generation comparing
  405. with another marked generation.
  406. @end table
  407. @node Miscellaneous Commands
  408. @section Miscellaneous Commands
  409. And some more commands related to profiles and packages:
  410. @table @kbd
  411. @cindex graph
  412. @findex guix-package-graph
  413. @item M-x guix-package-graph
  414. Show a package graph. You'll be prompted for a package name, graph
  415. backend and graph node type (everything can be completed with
  416. @key{TAB} key). @xref{Graph Configuration}, if you want to set an
  417. external graph viewer.
  418. @findex guix-package-size
  419. @item M-x guix-package-size
  420. Show a package size (@pxref{Invoking guix size,,, guix, The GNU Guix
  421. Reference Manual}). You'll be prompted for a package name and a size
  422. type (it should be either ``text'' or ``image'').
  423. @findex guix-lint
  424. @item M-x guix-lint
  425. Lint a package (@pxref{Invoking guix lint,,, guix, The GNU Guix
  426. Reference Manual}). You'll be prompted for a package name. With
  427. prefix argument, you'll be also prompted for checker names.
  428. @findex guix-apply-manifest
  429. @item M-x guix-apply-manifest
  430. Apply manifest file to the current profile or to a specified profile,
  431. if prefix argument is used. This has the same meaning as
  432. @code{--manifest} option (@pxref{Invoking guix package,,, guix, The
  433. GNU Guix Reference Manual}).
  434. @findex guix-pull
  435. @item M-x guix-pull
  436. It is the same as @command{guix pull} shell command (@pxref{Invoking
  437. guix pull,,, guix, The GNU Guix Reference Manual}). With @kbd{C-u},
  438. make it verbose.
  439. @cindex Guix REPL
  440. Once @command{guix pull} has succeeded, the Guix REPL is
  441. restarted@footnote{Note that name/version pairs cannot be used to
  442. identify packages (because a name is not necessarily unique), so
  443. Emacs-Guix uses special identifiers that live only during a guile
  444. session, so if the Guix REPL was restarted, you may want to revert
  445. ``list'' buffer (by pressing @kbd{g}).}. This allows you to keep
  446. using the Emacs interface with the updated Guix code.
  447. @end table
  448. @c ----------------------------------------------------------------
  449. @node Package Licenses
  450. @chapter Package Licenses
  451. @cindex package licenses
  452. If you want to browse the URL of a particular license, or to look at a
  453. list of licenses, you may use the following commands:
  454. @table @kbd
  455. @findex guix-browse-license-url
  456. @item M-x guix-browse-license-url
  457. Choose a license from a completion list to browse its URL using
  458. @code{browse-url} function (@pxref{Browse-URL,,, emacs, The GNU Emacs
  459. Manual}).
  460. @findex guix-licenses
  461. @item M-x guix-licenses
  462. Display a list of available licenses. You can press @kbd{P} key
  463. there to display packages with this license in the same way as
  464. @kbd{M-x@tie{}guix-packages-by-license} would do (@pxref{Package
  465. Commands}).
  466. @findex guix-find-license-definition
  467. @item M-x guix-find-license-definition
  468. Open @file{@dots{}/guix/licenses.scm} and move to the specified license.
  469. @end table
  470. @c ----------------------------------------------------------------
  471. @node Package Locations
  472. @chapter Package Locations
  473. @cindex package locations
  474. As you know, package definitions are placed in Guile files, also known
  475. as @dfn{package locations}. The following commands should help you not
  476. get lost in these locations:
  477. @table @kbd
  478. @findex guix-locations
  479. @item M-x guix-locations
  480. Display a list of package locations. You can press @kbd{P} or
  481. @kbd{@key{RET}} there to display packages placed in the current
  482. location in the same way as @kbd{M-x@tie{}guix-packages-by-location}
  483. would do (@pxref{Package Commands}). Note that when the point is on a
  484. location button, @key{RET} will open this location file.
  485. @findex guix-find-location
  486. @item M-x guix-find-location
  487. Open the given package definition source file (press @key{TAB} to choose
  488. a location from a completion list).
  489. @findex guix-edit
  490. @item M-x guix-edit
  491. Find location of a specified package. This is an Emacs analog of
  492. @command{guix edit} command (@pxref{Invoking guix edit,,, guix, The
  493. GNU Guix Reference Manual}). As with
  494. @kbd{M-x@tie{}guix-packages-by-name}, you can press @key{TAB} to
  495. complete a package name.
  496. @end table
  497. @vindex guix-directory
  498. If you are contributing to Guix, you may find it useful for
  499. @kbd{M-x@tie{}guix-find-location} and @kbd{M-x@tie{}guix-edit} to open
  500. locations from your Git checkout. This can be done by setting
  501. @code{guix-directory} variable. For example, after this:
  502. @example
  503. (setq guix-directory "~/src/guix")
  504. @end example
  505. @kbd{M-x guix-edit guix} opens
  506. @file{~/src/guix/gnu/packages/package-management.scm} file.
  507. Also you can use @kbd{C-u} prefix argument to specify a directory just
  508. for the current @kbd{M-x@tie{}guix-find-location} or
  509. @kbd{M-x@tie{}guix-edit} command.
  510. @c ----------------------------------------------------------------
  511. @node Popup Interface
  512. @chapter Popup Interface
  513. If you ever used Magit, you know what ``popup interface'' is
  514. (@pxref{Top,,, magit-popup, Magit-Popup User Manual}). Even if you are
  515. not acquainted with Magit, there should be no worries as it is very
  516. intuitive.
  517. @findex guix
  518. So @kbd{M-x@tie{}guix} command provides a top-level popup interface for
  519. all available guix commands. When you select an option, you'll be
  520. prompted for a value in the minibuffer. Many values have completions,
  521. so don't hesitate to press @key{TAB} key. Multiple values (for example,
  522. packages or lint checkers) should be separated by commas.
  523. After specifying all options and switches for a command, you may choose
  524. one of the available actions. The following default actions are
  525. available for all commands:
  526. @itemize
  527. @item
  528. Run the command in the Guix REPL. It is faster than running
  529. @code{guix@tie{}@dots{}} command directly in shell, as there is no
  530. need to run another guile process and to load required modules there.
  531. @item
  532. @vindex guix-run-in-shell-function
  533. Run the command in a shell buffer. You can set
  534. @code{guix-run-in-shell-function} variable to fine tune the shell buffer
  535. you want to use.
  536. @item
  537. Add the command line to the kill ring (@pxref{Kill Ring,,, emacs, The
  538. GNU Emacs Manual}).
  539. @end itemize
  540. @cindex graph
  541. Several commands (@command{guix graph}, @command{guix system
  542. shepherd-graph} and @command{guix system extension-graph}) also have a
  543. ``View graph'' action, which allows you to view a generated graph
  544. (@pxref{Graph Configuration}).
  545. @c ----------------------------------------------------------------
  546. @node Prettify Mode
  547. @chapter Guix Prettify Mode
  548. Emacs-Guix also comes with ``guix-prettify.el''. It provides a minor
  549. mode for abbreviating store file names by replacing hash sequences of
  550. symbols with ``@dots{}'':
  551. @example
  552. /gnu/store/72f54nfp6g1hz873w8z3gfcah0h4nl9p-foo-0.1
  553. @result{} /gnu/store/…-foo-0.1
  554. @end example
  555. @table @kbd
  556. @findex guix-prettify-mode
  557. @item M-x guix-prettify-mode
  558. Enable/disable prettifying for the current buffer.
  559. @findex global-guix-prettify-mode
  560. @item M-x global-guix-prettify-mode
  561. Enable/disable prettifying globally.
  562. @end table
  563. To automatically enable @code{guix-prettify-mode} globally on Emacs
  564. start, add the following line to your init file:
  565. @example
  566. (global-guix-prettify-mode)
  567. @end example
  568. If you want to enable it only for specific major modes, add it to the
  569. mode hooks (@pxref{Hooks,,, emacs, The GNU Emacs Manual}), for example:
  570. @example
  571. (add-hook 'shell-mode-hook 'guix-prettify-mode)
  572. (add-hook 'dired-mode-hook 'guix-prettify-mode)
  573. @end example
  574. @c ----------------------------------------------------------------
  575. @node Build Log Mode
  576. @chapter Build Log Mode
  577. @cindex build log
  578. @findex guix-build-log-mode
  579. Emacs-Guix provides major and minor modes for highlighting build logs.
  580. So when you have a file with a package build output---for example, a
  581. file returned by @command{guix build --log-file @dots{}} command
  582. (@pxref{Invoking guix build,,, guix, The GNU Guix Reference Manual}),
  583. you may call @kbd{M-x@tie{}guix-build-log-mode} command in the buffer
  584. with this file. This major mode highlights some lines specific to
  585. build output and provides the following key bindings:
  586. @table @kbd
  587. @item M-n
  588. Move to the next build phase.
  589. @item M-p
  590. Move to the previous build phase.
  591. @item @key{TAB}
  592. Toggle (show/hide) the body of the current build phase.
  593. @item S-@key{TAB}
  594. Toggle (show/hide) the bodies of all build phases.
  595. @end table
  596. @findex guix-build-log-minor-mode
  597. There is also @kbd{M-x@tie{}guix-build-log-minor-mode} which also
  598. provides the same highlighting and the same key bindings as the major
  599. mode, but prefixed with @kbd{C-c}. You may find this minor mode
  600. useful for shell buffers (@pxref{Interactive Shell,,, emacs, The GNU
  601. Emacs Manual}). It can be enabled there like this:
  602. @example
  603. (add-hook 'shell-mode-hook 'guix-build-log-minor-mode)
  604. @end example
  605. @c ----------------------------------------------------------------
  606. @node Completions
  607. @chapter Shell Completions
  608. @cindex shell
  609. @cindex completions
  610. Another available feature is completing @command{guix} subcommands,
  611. options, packages and other things in @code{shell} (@pxref{Interactive
  612. Shell,,, emacs, The GNU Emacs Manual}) and @code{eshell}
  613. (@pxref{Top,,, eshell, Eshell: The Emacs Shell}) buffers.
  614. It works the same way as other completions do. Just press @key{TAB}
  615. when your intuition tells you.
  616. And here are some examples, where pressing @key{TAB} may complete
  617. something:
  618. @itemize @w{}
  619. @item @code{guix pa}@key{TAB}
  620. @item @code{guix package -}@key{TAB}
  621. @item @code{guix package --}@key{TAB}
  622. @item @code{guix package -i gei}@key{TAB}
  623. @item @code{guix build -L/tm}@key{TAB}
  624. @item @code{guix build --sy}@key{TAB}
  625. @item @code{guix build --system=i}@key{TAB}
  626. @item @code{guix system rec}@key{TAB}
  627. @item @code{guix lint --checkers=sy}@key{TAB}
  628. @item @code{guix lint --checkers=synopsis,des}@key{TAB}
  629. @item @code{guix graph --backend=}@key{TAB}
  630. @end itemize
  631. @c ----------------------------------------------------------------
  632. @node Development
  633. @chapter Development
  634. @findex guix-devel-mode
  635. If you often work with Guix package files, you may want to see some
  636. highlighting and to have some indentation rules specific for Guix
  637. keywords. There is a minor mode to help
  638. you---@kbd{M-x@tie{}guix-devel-mode}. It can be enabled in Scheme
  639. buffers like this:
  640. @example
  641. (add-hook 'scheme-mode-hook 'guix-devel-mode)
  642. @end example
  643. Along with highlighting and indentation, this minor mode provides the
  644. following key bindings:
  645. @table @kbd
  646. @item C-c . k
  647. Copy the name of the current Guile module into kill ring
  648. (@code{guix-devel-copy-module-as-kill}).
  649. @item C-c . u
  650. Use the current Guile module. Often after opening a Scheme file, you
  651. want to use a module it defines, so you switch to the Geiser REPL and
  652. write @code{,use (some module)} there. You may just use this command
  653. instead (@code{guix-devel-use-module}).
  654. @item C-c . b
  655. Build a package defined by the current variable definition. The
  656. building process is run in the current Geiser REPL. If you modified the
  657. current package definition, don't forget to reevaluate it before calling
  658. this command---for example, with @kbd{C-M-x} (@pxref{To eval or not to
  659. eval,,, geiser, Geiser User Manual})
  660. (@code{guix-devel-build-package-definition}).
  661. @item C-c . s
  662. Build a source derivation of the package defined by the current
  663. variable definition. This command has the same meaning as @code{guix
  664. build -S} shell command (@pxref{Invoking guix build,,, guix, The GNU
  665. Guix Reference Manual}) (@code{guix-devel-build-package-source}).
  666. @item C-c . d
  667. Download a source of the package defined by the current variable
  668. definition. This command is the same as running @code{guix download}
  669. shell command on the package source (@pxref{Invoking guix download,,,
  670. guix, The GNU Guix Reference Manual})
  671. (@code{guix-devel-download-package-source}).
  672. @item C-c . l
  673. Lint (check) a package defined by the current variable definition
  674. (@pxref{Invoking guix lint,,, guix, The GNU Guix Reference Manual})
  675. (@code{guix-devel-lint-package}).
  676. @end table
  677. Unluckily, there is a limitation related to long-running REPL commands.
  678. When there is a running process in a Geiser REPL, you are not supposed
  679. to evaluate anything in a scheme buffer, because this will ``freeze''
  680. the REPL: it will stop producing any output (however, the evaluating
  681. process will continue---you will just not see any progress anymore). Be
  682. aware: even moving the point in a scheme buffer may ``break'' the REPL
  683. if Autodoc (@pxref{Autodoc and friends,,, geiser, Geiser User Manual})
  684. is enabled (which is the default).
  685. So you have to postpone editing your scheme buffers until the running
  686. evaluation will be finished in the REPL.
  687. Alternatively, to avoid this limitation, you may just run another Geiser
  688. REPL, and while something is being evaluated in the previous REPL, you
  689. can continue editing a scheme file with the help of the current one.
  690. @c ----------------------------------------------------------------
  691. @node Hydra
  692. @chapter Hydra
  693. @cindex hydra
  694. The continuous integration server at @code{hydra.gnu.org} builds all
  695. the distribution packages on the supported architectures and serves
  696. them as substitutes (@pxref{Substitutes,,, guix, The GNU Guix
  697. Reference Manual}). Continuous integration is currently orchestrated
  698. by @uref{https://nixos.org/hydra/, Hydra}.
  699. This section describes an Emacs interface to query Hydra to know the
  700. build status of specific packages, discover recent and ongoing builds,
  701. view build logs, and so on. This interface is mostly the same as the
  702. ``list''/``info'' interface for displaying packages and generations
  703. (@pxref{Package Management}).
  704. The following commands are available:
  705. @table @kbd
  706. @findex guix-hydra-latest-builds
  707. @item M-x guix-hydra-latest-builds
  708. Display latest failed or successful builds (you will be prompted for a
  709. number of builds). With @kbd{C-u}, you will also be prompted for other
  710. parameters (project, jobset, job and system).
  711. @findex guix-hydra-queued-builds
  712. @item M-x guix-hydra-queued-builds
  713. Display scheduled or currently running builds (you will be prompted for
  714. a number of builds).
  715. @findex guix-hydra-jobsets
  716. @item M-x guix-hydra-jobsets
  717. Display available jobsets (you will be prompted for a project).
  718. @end table
  719. In a list of builds you can press @kbd{L} key to display a build log of
  720. the current build. Also both a list of builds and a list of jobsets
  721. provide @kbd{B} key to display latest builds of the current job or
  722. jobset (don't forget about @kbd{C-u}).
  723. @c ----------------------------------------------------------------
  724. @node List/Info Interface
  725. @chapter List/Info Interface
  726. As you probably already know, there are multiple commands that display
  727. various lists (of packages, licenses, etc.). This is so-called
  728. ``list'' interface. Also you can get the same data displayed in
  729. ``info'' interface. This chapter describes these interfaces.
  730. @menu
  731. * List/Info Keys:: Common keys for both interfaces.
  732. * ``List'' buffer: List buffer. List-like interface.
  733. * ``Info'' buffer: Info buffer. Help-like interface.
  734. @end menu
  735. @node List/Info Keys
  736. @section List/Info Keys
  737. The following keys are available for both ``list'' and ``info''
  738. interfaces:
  739. @table @kbd
  740. @item h
  741. Show ``hint'' (a message with available key bindings).
  742. @item l
  743. @itemx r
  744. Go backward/forward by the history of the displayed results (this
  745. history is similar to the history of the Emacs @code{help-mode} or
  746. @code{Info-mode}).
  747. @item g
  748. Revert current buffer: update (receive it again) the currently
  749. displayed data and redisplay it.
  750. @item R
  751. Redisplay current buffer (without updating the data).
  752. @item ?
  753. Describe current mode.
  754. @end table
  755. Also some buffers provide the following keys:
  756. @table @kbd
  757. @item M
  758. Apply manifest file to the current profile (@pxref{Miscellaneous
  759. Commands, @code{guix-apply-manifest}}).
  760. @item C-c C-z
  761. @cindex Guix REPL
  762. Go to the Guix REPL (@pxref{The REPL,,, geiser, Geiser User Manual}).
  763. @end table
  764. @emph{Hint:} If you need several ``list'' or ``info'' buffers, you can
  765. simply @kbd{M-x@tie{}clone-buffer} them, and each buffer will have its
  766. own history.
  767. @node List buffer
  768. @section ``List'' buffer
  769. An interface of a ``list'' buffer is similar to the interface provided
  770. by ``package.el'' (@pxref{Package Menu,,, emacs, The GNU Emacs Manual}).
  771. And here are the default key bindings (some of them may be rebound
  772. to more specific commands):
  773. @table @kbd
  774. @item m
  775. Mark the current entry (with prefix, mark all entries).
  776. @item u
  777. Unmark the current entry (with prefix, unmark all entries).
  778. @item @key{DEL}
  779. Unmark backward.
  780. @item @key{RET}
  781. @itemx i
  782. Display ``info'' interface for the marked entries (or the current
  783. entry if nothing is marked).
  784. @item s
  785. Sort entries by column specified by the prefix argument (counting from
  786. 0).
  787. @end table
  788. @node Info buffer
  789. @section ``Info'' buffer
  790. The interface of an ``info'' buffer is similar to the interface of
  791. @code{help-mode} (@pxref{Help Mode,,, emacs, The GNU Emacs Manual}),
  792. or rather @code{Custom-mode} (@pxref{Easy Customization,,, emacs, The
  793. GNU Emacs Manual}), as it is full of various buttons that can be used
  794. to open files, browse URLs, do some actions (like installing/removing
  795. packages), etc.
  796. @cindex buttons
  797. As always, you may use @key{TAB} / @kbd{S-@key{TAB}} to move between
  798. buttons and @key{RET} to press a button, or you can just use mouse
  799. (@pxref{Mouse References,,, emacs, The GNU Emacs Manual}).
  800. Finally, you can copy any button label (a link to an URL or a file) by
  801. pressing @kbd{c} on a button.
  802. @c ----------------------------------------------------------------
  803. @node Configuration
  804. @chapter Configuration
  805. @cindex customization group
  806. There are many variables you can modify to change the appearance or
  807. behavior of Emacs-Guix. Some of these variables are described in this
  808. section. Also you can use Custom Interface (@pxref{Easy
  809. Customization,,, emacs, The GNU Emacs Manual}) to explore/set
  810. variables and faces---@kbd{M-x@tie{}customize-group @key{RET} guix}.
  811. @vindex guix-ENTRY-TYPE-BUFFER-TYPE-format
  812. If you wish to change the appearance of ``list'' / ``info'' buffers,
  813. look at @code{guix-ENTRY-TYPE-BUFFER-TYPE-format} variables
  814. (@dfn{ENTRY-TYPE} can be @code{package}, @code{output},
  815. @code{profile}, @code{generation} @code{system-generation},
  816. @code{license}, @code{location}, @code{hydra-build},
  817. @code{hydra-jobset}; @dfn{BUFFER-TYPE} is either @code{list} or
  818. @code{info}).
  819. @menu
  820. * Graph Configuration:: Set external viewer for graphs, etc.
  821. * Guile and Build Options:: Settings for Guix REPL, Guile, etc.
  822. * Buffer Names:: Names of Guix buffers.
  823. * Keymaps:: Configuring key bindings.
  824. @end menu
  825. @node Graph Configuration
  826. @section Graph Configuration
  827. @cindex graph
  828. Some commands may display a graph image. Currently Guix provides 2
  829. graph backends (@pxref{Invoking guix graph,,, guix, The GNU Guix
  830. Reference Manual}):
  831. @table @code
  832. @item d3js
  833. Such graph will be displayed in your browser using @code{browse-url}
  834. function (@pxref{Browse-URL,,, emacs, The GNU Emacs Manual}).
  835. @item graphviz
  836. Such graph will be displayed inside Emacs by default, but this can be
  837. configured @dots{}
  838. @end table
  839. @vindex guix-find-file-function
  840. @dots{} Graphs are opened using @code{guix-find-file-function}, so if
  841. you want to use an external viewer, you need to set this variable.
  842. Probably the easiest way to set an external viewer is to use a
  843. functionality provided by the Org Mode. For example, if you want to
  844. open the generated graphs (PNG files) with @code{sxiv} image viewer,
  845. you can do it like this:
  846. @example
  847. (setq guix-find-file-function 'org-open-file)
  848. (add-to-list 'org-file-apps '("\\.png\\'" . "sxiv %s"))
  849. @end example
  850. Now some deeper details and configuration options.
  851. @vindex guix-dot-program
  852. @vindex guix-dot-default-arguments
  853. @vindex guix-dot-file-name-function
  854. The @code{graphviz} graph is converted into an image file using
  855. @command{dot} command specified by @code{guix-dot-program} and
  856. @code{guix-dot-default-arguments} variables. By default, a PNG file is
  857. generated and saved as @file{/tmp/emacs-guix-XXXXXX/graph-XXXXXX.png}.
  858. If you want to change an output format (for example, into PDF), you also
  859. need to change @code{guix-dot-file-name-function} (to make @code{.pdf}
  860. extension of the output file). This can be done like this:
  861. @example
  862. (defun my-guix-pdf-graph ()
  863. "/tmp/my-current-guix-graph.pdf")
  864. (setq guix-dot-default-arguments '("-Tpdf")
  865. guix-dot-file-name-function 'my-guix-pdf-graph)
  866. @end example
  867. @node Guile and Build Options
  868. @section Guile and Build Options
  869. @table @code
  870. @vindex guix-guile-program
  871. @item guix-guile-program
  872. If you have some special needs for starting a Guile process, you may set
  873. this variable, for example:
  874. @example
  875. (setq guix-guile-program '("/bin/guile" "--no-auto-compile"))
  876. @end example
  877. @vindex guix-use-substitutes
  878. @item guix-use-substitutes
  879. Has the same meaning as @code{--no-substitutes} option
  880. (@pxref{Invoking guix build,,, guix, The GNU Guix Reference
  881. Manual})---i.e., when non-nil, substitutes are enabled.
  882. @vindex guix-dry-run
  883. @item guix-dry-run
  884. Has the same meaning as @code{--dry-run} option (@pxref{Invoking guix
  885. build,,, guix, The GNU Guix Reference Manual})---i.e., when non-nil,
  886. do not build the derivations.
  887. @cindex Guix REPL
  888. @vindex guix-repl-use-server
  889. @item guix-repl-use-server
  890. By default, along with the main Guix REPL, an additional (internal)
  891. REPL is started. This allows you to display packages, generations and
  892. to receive other info from the Scheme side, while there is some active
  893. process in the main Guix REPL (e.g., while downloading or building
  894. packages). If you don't want to have the second REPL, set this
  895. variable to nil.
  896. @vindex guix-repl-use-latest
  897. @item guix-repl-use-latest
  898. Set this variable to nil, if you don't want to use the latest Guix
  899. code received with @code{guix pull} command (@pxref{Invoking guix
  900. pull,,, guix, The GNU Guix Reference Manual}).
  901. @end table
  902. @node Buffer Names
  903. @section Buffer Names
  904. Default names of various Emacs-Guix buffers (``*Guix@tie{}@dots{}*'')
  905. may be changed with the following variables:
  906. @table @code
  907. @vindex guix-ENTRY-TYPE-BUFFER-TYPE-buffer-name
  908. @item guix-ENTRY-TYPE-BUFFER-TYPE-buffer-name
  909. @xref{Configuration}, for the meaning of @code{ENTRY-TYPE} and
  910. @code{BUFFER-TYPE}.
  911. @vindex guix-ui-buffer-name-function
  912. @item guix-ui-buffer-name-function
  913. By default, many Guix buffers contain profile name (e.g., @code{*Guix
  914. Packages: <profile>*}). This variable allows you to control how this
  915. profile name is displayed. If you want to remove profile name from
  916. the buffer names, you can do it like this:
  917. @example
  918. (setq guix-ui-buffer-name-function 'guix-ui-buffer-name-simple)
  919. @end example
  920. @vindex guix-repl-buffer-name
  921. @item guix-repl-buffer-name
  922. @vindex guix-internal-repl-buffer-name
  923. @item guix-internal-repl-buffer-name
  924. @vindex guix-help-buffer-name
  925. @item guix-help-buffer-name
  926. @end table
  927. @node Keymaps
  928. @section Keymaps
  929. If you want to change default key bindings, look at the following
  930. keymaps (@pxref{Init Rebinding,,, emacs, The GNU Emacs Manual}):
  931. @table @code
  932. @vindex guix-ui-map
  933. @item guix-ui-map
  934. Parent keymap with general keys for buffers used for Guix package
  935. management.
  936. @vindex guix-ENTRY-TYPE-BUFFER-TYPE-mode-map
  937. @item guix-ENTRY-TYPE-BUFFER-TYPE-mode-map
  938. @xref{Configuration}, for the meaning of @code{ENTRY-TYPE} and
  939. @code{BUFFER-TYPE}.
  940. @vindex guix-build-log-common-map
  941. @item guix-build-log-common-map
  942. @vindex guix-build-log-mode-map
  943. @item guix-build-log-mode-map
  944. @vindex guix-build-log-minor-mode-map
  945. @item guix-build-log-minor-mode-map
  946. @vindex guix-devel-keys-map
  947. @item guix-devel-keys-map
  948. @vindex guix-devel-mode-map
  949. @item guix-devel-mode-map
  950. @end table
  951. @c ----------------------------------------------------------------
  952. @node Help
  953. @chapter Help
  954. So many commands, so many buffers! This chapter describes few more
  955. commands that should help you not to get lost.
  956. @table @kbd
  957. @findex guix-help
  958. @item M-x guix-help
  959. Display a buffer with the summary of the available Emacs-Guix
  960. commands. Buttons in this buffer allow you to run commands and to
  961. look at their docstrings and manual entries.
  962. @findex guix-switch-to-buffer
  963. @item M-x guix-switch-to-buffer
  964. Switch to one of the Emacs-Guix buffers. This is like a usual
  965. @code{switch-to-buffer} (bound to @kbd{C-x b} by default), except it
  966. completes only Guix buffers names. If you are going to use this
  967. command, it is probably better to bind it to some key, for example:
  968. @example
  969. (global-set-key (kbd "C-x B") 'guix-switch-to-buffer)
  970. @end example
  971. @findex guix-extended-command
  972. @item M-x guix-extended-command
  973. Run Emacs-Guix command. This is like @kbd{M-x} (@pxref{M-x,,, emacs,
  974. The GNU Emacs Manual}), except it completes only Guix command names.
  975. And again, this is not a very useful command unless it is bound to
  976. some key, for example:
  977. @example
  978. (global-set-key (kbd "M-X") 'guix-extended-command)
  979. @end example
  980. @end table
  981. @c ----------------------------------------------------------------
  982. @node Concept Index
  983. @unnumbered Concept Index
  984. @printindex cp
  985. @node Command Index
  986. @unnumbered Command Index
  987. @printindex fn
  988. @node Variable Index
  989. @unnumbered Variable Index
  990. @printindex vr
  991. @bye