emacs-guix.texi 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858
  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-2019, 2021 Alex Kost@*
  10. Copyright @copyright{} 2018 Oleg Pykhalov
  11. Permission is granted to copy, distribute and/or modify this document
  12. under the terms of the GNU Free Documentation License, Version 1.3
  13. or any later version published by the Free Software Foundation;
  14. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
  15. A copy of the license is available at
  16. @url{http://www.gnu.org/licenses/fdl.html}.
  17. @end quotation
  18. @end copying
  19. @dircategory Emacs
  20. @direntry
  21. * Emacs-Guix: (Emacs-Guix). Emacs interface for GNU Guix
  22. @end direntry
  23. @titlepage
  24. @title Emacs-Guix User Manual
  25. @author Alex Kost
  26. @page
  27. @vskip 0pt plus 1filll
  28. @insertcopying
  29. @end titlepage
  30. @contents
  31. @c ----------------------------------------------------------------
  32. @node Top
  33. @top Emacs-Guix
  34. @insertcopying
  35. @menu
  36. * Introduction:: Quick overview.
  37. * Installation:: Installing Emacs-Guix.
  38. * Packages:: Interface for packages.
  39. * Profiles and Generations:: Interface for profiles and their generations.
  40. * System:: Interface for @code{operating-system} and services.
  41. * Store Items:: Interface for store items.
  42. * Package Licenses:: Interface for licenses of packages.
  43. * Popup Interface:: Magit-like interface for Emacs-Guix commands.
  44. * Prettify Mode:: Abbreviating @file{/gnu/store/@dots{}} file names.
  45. * Prettify Variables:: Split and indent Shell variables.
  46. * Build Log Mode:: Highlighting Guix build logs.
  47. * Completions:: Completing @command{guix} shell command.
  48. * Development:: Highlighting and tools for Guix code.
  49. * List/Info Interface:: Describing ``list''/''info'' buffers.
  50. * Configuration:: Configuring Emacs-Guix.
  51. * Miscellaneous Commands:: @kbd{M-x guix-@dots{}} uncovered by other sections.
  52. * Help:: Help commands.
  53. Indexes
  54. * Concept Index:: Concepts.
  55. * Command Index:: Commands and functions.
  56. * Variable Index:: Variables.
  57. @end menu
  58. @c ----------------------------------------------------------------
  59. @node Introduction
  60. @chapter Introduction
  61. Emacs-Guix (also known as ``guix.el'') provides various interfaces and
  62. tools related to the GNU Guix package manager.
  63. Call @kbd{M-x guix} if you prefer to dive in right away (@pxref{Popup
  64. Interface}).
  65. In short, Emacs-Guix provides the following features:
  66. @itemize @bullet
  67. @item
  68. Interfaces for:
  69. @itemize @minus
  70. @item profiles (@pxref{Profiles})
  71. @item profile generations (@pxref{Generations})
  72. @item packages (@pxref{Packages})
  73. @item package locations (@pxref{Package Locations})
  74. @item package licenses (@pxref{Package Licenses})
  75. @item @code{operating-system} declaration (@pxref{System From File})
  76. @item services (@pxref{Services})
  77. @item service locations (@pxref{Service Locations})
  78. @item store items (@pxref{Store Items})
  79. @end itemize
  80. @item
  81. Magit-like popup interface for all Emacs-Guix @kbd{M-x} commands and
  82. Guix shell commands (@pxref{Popup Interface}).
  83. @item
  84. Modes to view logs of package builds (@pxref{Build Log Mode}).
  85. @item
  86. Minor mode to ``prettify'' store file names (@pxref{Prettify Mode}).
  87. @item
  88. Shell completions for all guix commands and options
  89. (@pxref{Completions}).
  90. @item
  91. Minor mode with additional functionality for @code{scheme-mode} to
  92. work with Guix Scheme files (@pxref{Development}).
  93. @end itemize
  94. @c ----------------------------------------------------------------
  95. @node Installation
  96. @chapter Installation
  97. @cindex installation
  98. There are several ways@footnote{It is not recommended to mix several
  99. installations (in particular, installations from Guix and MELPA), as
  100. it may lead to incompatibilities in the source (@code{.scm}) and
  101. compiled (@code{.go}) Guile files.} to install Emacs-Guix:
  102. @itemize
  103. @item Installing using GNU Guix
  104. @example
  105. $ guix package -i emacs-guix
  106. @end example
  107. @item Installing from @uref{http://melpa.org/, MELPA}
  108. @item Using from a git checkout
  109. @end itemize
  110. For the first 2 options, you are all set, so you can skip this
  111. chapter. If you want to use Emacs-Guix from a git checkout, read
  112. further.
  113. @menu
  114. * Requirements:: Required and optional dependencies.
  115. * Using from Git:: Using without installation.
  116. @end menu
  117. @node Requirements
  118. @section Requirements
  119. Emacs-Guix depends on the following packages:
  120. @itemize
  121. @item
  122. @uref{http://www.gnu.org/software/emacs/, GNU Emacs}, version 24.3 or
  123. later.
  124. @item
  125. @uref{http://www.gnu.org/software/guix/, GNU Guix}, version 0.11.0 or
  126. later. You need it for the most features of Emacs-Guix, but not for
  127. all: Guix is not needed if you want to look at log files (@pxref{Build
  128. Log Mode}) or to ``prettify'' store file names (@pxref{Prettify Mode}).
  129. @item
  130. @uref{https://notabug.org/cwebber/guile-gcrypt, Guile-Gcrypt}, version
  131. 0.1.0 or later. It is needed only for @kbd{M-x@tie{}guix-hash}
  132. command (@pxref{Miscellaneous Commands}).
  133. @item
  134. @uref{http://nongnu.org/geiser/, Geiser}, version 0.8 or later. It is
  135. used to communicate with the Guix daemon, and to receive various info
  136. from the Guix Guile code. So without Geiser, you can use the same
  137. features as without Guix.
  138. @item
  139. @uref{https://github.com/magnars/dash.el, dash library}, version
  140. 2.11.0 or later.
  141. @item
  142. @uref{https://gitlab.com/alezost-emacs/bui, BUI library}, version
  143. 1.2.0 or later. It is used to define various ``list''/``info''
  144. interfaces (to display packages, generations, licenses, etc.).
  145. @item
  146. @uref{https://github.com/magit/magit-popup, magit-popup library}. You
  147. already have this library if you use Magit 2.1.0 or later. This
  148. library is required only for @kbd{M-x@tie{}guix} command (@pxref{Popup
  149. Interface}).
  150. @item
  151. @uref{https://github.com/Fanael/edit-indirect, edit-indirect library},
  152. version 0.1.4 or later. It is used only to edit synopsis/description
  153. in @code{guix-devel-mode} (@pxref{Development}).
  154. @item
  155. @uref{https://gitlab.com/alezost-emacs/build-farm, Emacs-Build-Farm},
  156. version 0.2.1 or later. Emacs-Guix provides some integration features
  157. for this package (if it is installed), for example, @kbd{B} key in a
  158. list of packages (@pxref{Package Keys}).
  159. @end itemize
  160. To sum up, most likely, you'll need all the above dependencies except
  161. maybe @code{magit-popup}, @code{edit-indirect} and @code{build-farm}.
  162. @node Using from Git
  163. @section Using from Git
  164. You can use Emacs-Guix directly from a git checkout without any
  165. installation.
  166. At first, you need to clone the repository and to run
  167. @code{autogen.sh} script (it's just a wrapper for @code{autoreconf}
  168. command). If you don't have all dependencies installed, you may use
  169. @file{guix.scm} file to make an environment to build Emacs-Guix
  170. (@pxref{Invoking guix environment,,, guix, The GNU Guix Reference
  171. Manual}):
  172. @example
  173. $ git clone https://notabug.org/alezost/emacs-guix.git
  174. $ cd guix.el
  175. $ guix environment --pure --load=guix.scm
  176. $ ./autogen.sh
  177. @end example
  178. Now configure and make it (this will compile all Emacs-Lisp and Scheme
  179. files, and will generate @file{guix-autoloads.el} file):
  180. @example
  181. $ ./configure
  182. $ make
  183. @end example
  184. Now all you need, is to add @file{elisp} directory to the Emacs
  185. @code{load-path} and to load the generated autoloads. This can be
  186. done by adding the following code into your Emacs init file
  187. (@pxref{Init File,,, emacs, The GNU Emacs Manual}):
  188. @example
  189. (add-to-list 'load-path "/path/to/emacs-guix/elisp")
  190. (require 'guix-autoloads nil t)
  191. @end example
  192. Now, if you start Emacs, all @kbd{M-x guix-@dots{}} commands should
  193. become available.
  194. @node Using the Manual from Git
  195. @subsection Using the Manual from Git
  196. After ``make''-ing, the info manual is ready to use. You can run it,
  197. for example, with @kbd{C-u C-h i} command (the file is
  198. @file{doc/emacs-guix.info}). However it is not convenient. You may
  199. want to have this manual in the top info directory along with the
  200. other manuals. To make it possible, you need to do the following 2
  201. steps:
  202. @itemize
  203. @item
  204. At first, you need to add the doc directory to your Info path. One
  205. way to do it is to extend INFOPATH environment variable:
  206. @example
  207. export INFOPATH="/path/to/emacs-guix/doc$@{INFOPATH:+:@}$INFOPATH"
  208. @end example
  209. Alternatively, you can adjust Info path inside Emacs, like this:
  210. @example
  211. (with-eval-after-load 'info
  212. (info-initialize)
  213. (add-to-list 'Info-directory-list "/path/to/emacs-guix/doc"))
  214. @end example
  215. @item
  216. And secondly, the doc directory should contain @file{dir} file
  217. (@pxref{Directory File,,, texinfo, The GNU Texinfo Manual}). It can
  218. be generated simply by running the following command:
  219. @example
  220. make doc/dir
  221. @end example
  222. @end itemize
  223. Once the above 2 steps are done, @kbd{C-h i} should display the
  224. Emacs-Guix entry. Also you can use @kbd{M-x guix-info} command to run
  225. the manual (@pxref{Help}).
  226. @c ----------------------------------------------------------------
  227. @node Packages
  228. @chapter Packages
  229. @cindex packages
  230. Emacs-Guix provides a visual interface for packages where you can
  231. perform routine package management tasks, pretty much like the
  232. @command{guix package} command (@pxref{Invoking guix package,,, guix,
  233. The GNU Guix Reference Manual}).
  234. @menu
  235. * Package Commands:: @kbd{M-x guix-@dots{}} to show packages.
  236. * Package Keys:: Key bindings in package ``list'' and ``info'' buffers.
  237. * Package Locations:: Interface for locations of packages.
  238. * Lint Checkers:: Interface for package lint checkers.
  239. * More Package Commands:: Other @kbd{M-x guix-@dots{}} related to packages.
  240. @end menu
  241. @node Package Commands
  242. @section Package Commands
  243. There are multiple commands to display a list of Guix packages. You
  244. can either perform some actions in such ``package-list'' buffer, or
  245. ``describe'' package(s) in ``package-info'' buffer using
  246. @kbd{@key{RET}}.
  247. @findex guix-set-current-profile
  248. The following commands use the current profile, which can be changed
  249. globally with @kbd{M-x@tie{}guix-set-current-profile} (@pxref{Profile
  250. Commands}). Alternatively, if you call any of the following commands
  251. with a prefix argument (@kbd{C-u}), you will be prompted for a profile
  252. just for that command.
  253. @table @kbd
  254. @findex guix-all-packages
  255. @item M-x guix-all-packages
  256. Display all available packages.
  257. @findex guix-installed-packages
  258. @item M-x guix-installed-packages
  259. @findex guix-installed-user-packages
  260. @itemx M-x guix-installed-user-packages
  261. @findex guix-installed-system-packages
  262. @itemx M-x guix-installed-system-packages
  263. Display installed packages. As explained above, @kbd{M-x
  264. guix-installed-packages} uses an arbitrary profile that you can specify,
  265. while the other commands display packages installed in 2 special
  266. profiles: @file{~/.guix-profile} and @file{/run/current-system/profile}
  267. (only on Guix System).
  268. @findex guix-obsolete-packages
  269. @item M-x guix-obsolete-packages
  270. Display obsolete or unknown packages (the packages that are installed
  271. in a profile but cannot be found among the available packages).
  272. @findex guix-superseded-packages
  273. @item M-x guix-superseded-packages
  274. Display packages that are superseded by the other packages.
  275. @findex guix-hidden-packages
  276. @item M-x guix-hidden-packages
  277. Display packages that are hidden from user interfaces (usually because
  278. they are for internal use only).
  279. @findex guix-dependent-packages
  280. @item M-x guix-dependent-packages
  281. Display packages that depend on the specified package(s). This
  282. command is analogous to @code{guix refresh --list-dependent} shell
  283. command (@pxref{Invoking guix refresh,,, guix, The GNU Guix Reference
  284. Manual}). You'll be prompted for a package name (or multiple names,
  285. separated by commas) and a dependency type (it should be either
  286. ``all'' or ``direct'').
  287. @findex guix-packages-by-name
  288. @item M-x guix-packages-by-name
  289. Display package(s) with the specified name.
  290. @findex guix-packages-by-regexp
  291. @vindex guix-package-search-params
  292. @item M-x guix-packages-by-regexp
  293. Search for packages by a specified regexp. By default, ``name'',
  294. ``synopsis'' and ``description'' of the packages will be searched. This
  295. can be changed by modifying @code{guix-package-search-params} variable.
  296. @findex guix-packages-by-name-regexp
  297. @item M-x guix-packages-by-name-regexp
  298. Search for packages with names matching a specified regexp. This
  299. command is the same as @code{guix-packages-by-regexp}, except only a
  300. package ``name'' is searched.
  301. @findex guix-packages-by-license
  302. @item M-x guix-packages-by-license
  303. Display package(s) with the specified license.
  304. @findex guix-packages-by-location
  305. @item M-x guix-packages-by-location
  306. Display package(s) located in the specified file. These files usually
  307. have the following form: @file{gnu/packages/emacs.scm}, but don't type
  308. them manually! Press @kbd{@key{TAB}} to complete the file name.
  309. @findex guix-package-from-file
  310. @item M-x guix-package-from-file
  311. Display package that the code within the specified file evaluates to.
  312. @xref{Invoking guix package, @code{--install-from-file},, guix, The
  313. GNU Guix Reference Manual}, for an example of what such a file may
  314. look like.
  315. @findex guix-packages-from-system-config-file
  316. @item M-x guix-packages-from-system-config-file
  317. Display packages from the specified file with @code{operating-system}
  318. declaration (@pxref{Using the Configuration System,,, guix, The GNU
  319. Guix Reference Manual}).
  320. @end table
  321. @vindex guix-package-list-type
  322. By default, these commands display each package @strong{output} on a
  323. separate line. If you prefer to see a list of packages---i.e., a list
  324. with a @strong{package} per line, use the following setting:
  325. @example
  326. (setq guix-package-list-type 'package)
  327. @end example
  328. @node Package Keys
  329. @section Package Keys
  330. @subsection List Buffer
  331. Along with the general ``list'' keys (@pxref{List buffer}), a
  332. ``package-list'' buffer additionally provides the following key
  333. bindings:
  334. @table @kbd
  335. @item i
  336. Mark the current package for installation.
  337. @item d
  338. Mark the current package for deletion.
  339. @item U
  340. Mark the current package for upgrading.
  341. @item ^
  342. Mark all obsolete packages for upgrading (with prefix, mark all
  343. installed packages for upgrading).
  344. @item x
  345. Execute actions on the marked packages.
  346. @item e
  347. Edit the definition of the current package (go to its location). This
  348. is similar to @command{guix edit} command (@pxref{Invoking guix
  349. edit,,, guix, The GNU Guix Reference Manual}), but for opening a
  350. package recipe in the current Emacs instance.
  351. @item G
  352. @cindex graph
  353. Show graph for the current package (@pxref{Graph Configuration}).
  354. @item z
  355. Show package size (@pxref{Invoking guix size,,, guix, The GNU Guix
  356. Reference Manual}).
  357. @item L
  358. Lint the current package (@pxref{Invoking guix lint,,, guix, The GNU
  359. Guix Reference Manual}). With prefix argument, you'll be prompted for
  360. checker names.
  361. @item B
  362. Display latest builds (from the Guix build farm) of the current
  363. package.
  364. @end table
  365. @subsection Info Buffer
  366. Similarly, ``package-info'' buffer provides the following key bindings:
  367. @table @kbd
  368. @item i
  369. Install the current package.
  370. @item d
  371. Delete the current package.
  372. @item U
  373. Upgrade the current package.
  374. @item e
  375. Go to the package definition.
  376. @item G
  377. Show package graph.
  378. @item z
  379. Show package size.
  380. @item L
  381. Lint the package.
  382. @end table
  383. @node Package Locations
  384. @section Package Locations
  385. @cindex package locations
  386. As you know, package definitions are placed in Guile files. The
  387. following commands should help you not get lost in these @dfn{package
  388. locations}:
  389. @table @kbd
  390. @findex guix-package-locations
  391. @item M-x guix-package-locations
  392. Display a list of files with package definitions. You can press @kbd{P}
  393. or @kbd{@key{RET}} there to display packages placed in the current file in
  394. the same way as @kbd{M-x@tie{}guix-packages-by-location} would do
  395. (@pxref{Package Commands}). Note that when the point is on a location
  396. button, @kbd{@key{RET}} will open this location file.
  397. @findex guix-find-package-location-file
  398. @item M-x guix-find-package-location-file
  399. Open a file with package definitions (press @kbd{@key{TAB}} to choose a
  400. file from the completion list).
  401. @findex guix-find-package-definition
  402. @item M-x guix-find-package-definition
  403. @findex guix-edit
  404. @itemx M-x guix-edit
  405. Find location of a specified package. This is an Emacs analog of
  406. @command{guix edit} command (@pxref{Invoking guix edit,,, guix, The
  407. GNU Guix Reference Manual}). As with
  408. @kbd{M-x@tie{}guix-packages-by-name}, you can press @kbd{@key{TAB}} to
  409. complete a package name.
  410. @end table
  411. @vindex guix-read-package-name-function
  412. By default, when you should specify a package name (for example, after
  413. @kbd{M-x guix-edit}), you will be prompted for it in the minibuffer,
  414. but you can configure Emacs-Guix to use a package name at the current
  415. point position (unless @kbd{C-u} is used):
  416. @example
  417. (setq guix-read-package-name-function 'guix-read-package-name-at-point)
  418. @end example
  419. @node Lint Checkers
  420. @section Lint Checkers
  421. The following commands provides functionality similar to @code{guix
  422. lint} shell command (@pxref{Invoking guix lint,,, guix, The GNU Guix
  423. Reference Manual}).
  424. @table @kbd
  425. @findex guix-lint-checkers
  426. @item M-x guix-lint-checkers
  427. Display a list of available lint checkers. You can press @kbd{L}
  428. there to lint the packages you will be prompted for with the marked
  429. checkers.
  430. @findex guix-package-lint
  431. @item M-x guix-package-lint
  432. Lint packages. You will be prompted for comma separated package
  433. names. With prefix argument, you will also be prompted for checker
  434. names.
  435. @end table
  436. @node More Package Commands
  437. @section More Package Commands
  438. And some more commands related to packages:
  439. @table @kbd
  440. @findex guix-number-of-packages
  441. @item M-x guix-number-of-packages
  442. This command just displays a message (in the minibuffer) with the
  443. number of available packages. Along with the default Guix packages,
  444. this number includes the packages from @code{GUIX_PACKAGE_PATH}
  445. environment variable (@pxref{Package Modules,,, guix, The GNU Guix
  446. Reference Manual}).
  447. @cindex graph
  448. @findex guix-package-graph
  449. @item M-x guix-package-graph
  450. Show a package graph. You'll be prompted for a package name, graph
  451. backend and graph node type (everything can be completed with
  452. @kbd{@key{TAB}} key). @xref{Graph Configuration}, if you want to set
  453. an external graph viewer.
  454. @findex guix-package-size
  455. @item M-x guix-package-size
  456. Show a package size (@pxref{Invoking guix size,,, guix, The GNU Guix
  457. Reference Manual}). You'll be prompted for a package name and a size
  458. type (it should be either ``text'' or ``image'').
  459. @end table
  460. @c ----------------------------------------------------------------
  461. @node Profiles and Generations
  462. @chapter Profiles and Generations
  463. As you know, packages are installed in @dfn{profiles}. The default
  464. user profile is @file{~/.guix-profile} (actually it is a symlink to
  465. the real profile) but you can also install packages to non-standard
  466. profiles (using @code{guix package --profile=@dots{}}).
  467. Profiles have @dfn{generations}. They appear whenever you perform any
  468. profile action (installing/removing packages). These generations are
  469. just symlinks to the previous versions of profile, so you can easily
  470. roll-back to any previous generation.
  471. As you may guess, Emacs-Guix provides an interface for profiles and
  472. their generations, where you can look at the packages from the old
  473. generations, switch to any generation, delete generations, etc.
  474. @menu
  475. * Profiles:: Interface for profiles.
  476. * Generations:: Interface for generations.
  477. @end menu
  478. @node Profiles
  479. @section Profiles
  480. @cindex profiles
  481. If you manage multiple Guix profiles, this section is for you.
  482. @kbd{M-x guix-profiles} is the entry point to display profiles. There
  483. you can look at the profile generations, installed packages and more.
  484. Read further for details.
  485. @menu
  486. * Profile Commands:: @kbd{M-x guix-profiles} and friends.
  487. * Profile Keys:: Key bindings in profile ``list'' buffer.
  488. @end menu
  489. @node Profile Commands
  490. @subsection Profile Commands
  491. @table @kbd
  492. @findex guix-profiles
  493. @vindex guix-profiles
  494. @item M-x guix-profiles
  495. Show a list of available Guix profiles. By default, it displays:
  496. @table @file
  497. @item ~/.guix-profile
  498. the default user profile
  499. @item ~/.config/guix/current
  500. profile, populated by @code{guix pull}
  501. @item /var/guix/profiles/system
  502. system profile (only on Guix System)
  503. @item @env{GUIX_PROFILE}
  504. (only if this environment variable is set and this profile is not the
  505. same as one of the above)
  506. @end table
  507. and other profiles shown by @code{guix package --list-profiles} shell
  508. command. If it is not enough for you, you can add even more profiles
  509. to this list by setting @code{guix-profiles} variable, for example,
  510. like this:
  511. @example
  512. (with-eval-after-load 'guix-ui-profile
  513. (setq guix-profiles
  514. (append '("/path/to/my-profile1"
  515. "/path/to/my-profile2")
  516. (guix-all-profiles))))
  517. @end example
  518. The ``profile-list'' buffer provides some keys to work with profiles
  519. (@pxref{Profile Keys}), but also there are the following standalone
  520. profile commands that can be called outside this buffer.
  521. @vindex guix-current-profile
  522. @findex guix-set-current-profile
  523. @item M-x guix-set-current-profile
  524. Set the current profile (@code{guix-current-profile} variable) to the
  525. specified one. The current profile is used by the package commands
  526. (@pxref{Package Commands}) to check what package is installed in this
  527. profile, and by generation commands (@pxref{Generation Commands}).
  528. @findex guix-apply-manifest
  529. @item M-x guix-apply-manifest
  530. Apply a manifest file to the current profile or a specified profile,
  531. if the prefix argument is used. This has the same meaning as
  532. @code{--manifest} option (@pxref{Invoking guix package,,, guix, The
  533. GNU Guix Reference Manual}).
  534. @end table
  535. @node Profile Keys
  536. @subsection Profile Keys
  537. Along with the general ``list'' keys (@pxref{List buffer}), a
  538. ``profile-list'' buffer (displayed by @kbd{M-x guix-profiles})
  539. additionally provides the following bindings:
  540. @table @kbd
  541. @item P
  542. Display packages installed in profile at point.
  543. @item G
  544. Display generations of profile at point.
  545. @item E
  546. Display ``search paths'' environment variables for the marked
  547. profiles, or the current profile if nothing is marked. This command
  548. is analogous to @code{guix package --search-paths} shell command
  549. (@pxref{Invoking guix package,,, guix, The GNU Guix Reference
  550. Manual}).
  551. @item c
  552. Make profile at point the current profile for the package commands
  553. (@pxref{Packages}).
  554. @item M
  555. Apply manifest from a specified file to the profile at point.
  556. @end table
  557. @node Generations
  558. @section Generations
  559. @cindex generations
  560. Each Guix profile may have multiple generations and Emacs-Guix allows
  561. you to display these generations, to switch to a particular
  562. generation, to look at the packages installed in it and to compare 2
  563. generations.
  564. @menu
  565. * Generation Commands:: @kbd{M-x guix-@dots{}} to show profile generations.
  566. * Generation Keys:: Key bindings in generation ``list'' buffer.
  567. @end menu
  568. @node Generation Commands
  569. @subsection Generation Commands
  570. As with commands for displaying packages (@pxref{Package Commands}),
  571. commands for displaying generations also use the current profile and
  572. can be called with a prefix argument.
  573. @table @kbd
  574. @findex guix-generations
  575. @item M-x guix-generations
  576. List all the generations.
  577. @findex guix-last-generations
  578. @item M-x guix-last-generations
  579. List the @var{N} last generations. You will be prompted for the number
  580. of generations.
  581. @findex guix-generations-by-time
  582. @item M-x guix-generations-by-time
  583. List generations matching time period. You will be prompted for the
  584. period using Org mode time prompt based on Emacs calendar (@pxref{The
  585. date/time prompt,,, org, The Org Manual}).
  586. @end table
  587. If you use Guix System, you may also look at the system generations using
  588. the similar commands (@pxref{System Commands}).
  589. @node Generation Keys
  590. @subsection Generation Keys
  591. Along with the general ``list'' keys (@pxref{List buffer}), a
  592. ``generation-list'' buffer additionally provides the following
  593. bindings:
  594. @table @kbd
  595. @item P
  596. Display packages installed in the current generation.
  597. @item E
  598. Display ``search paths'' environment variables for the marked
  599. generations. This command is similar to the one for a list of
  600. profiles (@pxref{Profiles}).
  601. @item c
  602. Switch profile to the current generation.
  603. @item d
  604. Mark the current generation for deletion (with prefix, mark all
  605. generations).
  606. @item x
  607. Execute actions on the marked generations---i.e., delete generations.
  608. @item e
  609. Run Ediff (@pxref{Top,,, ediff, The Ediff Manual}) on package outputs
  610. installed in the 2 marked generations. With prefix argument, run Ediff
  611. on manifests of the marked generations.
  612. @item =
  613. Run Diff (@pxref{Diff Mode,,, emacs, The GNU Emacs Manual}) on package
  614. outputs installed in the 2 marked generations. With prefix argument,
  615. run Diff on manifests of the marked generations.
  616. @item +
  617. List package outputs added to the latest marked generation comparing
  618. with another marked generation.
  619. @item -
  620. List package outputs removed from the latest marked generation comparing
  621. with another marked generation.
  622. @end table
  623. @c ----------------------------------------------------------------
  624. @node System
  625. @chapter System
  626. This chapter describes Emacs-Guix features related to Guix System, in
  627. particular:
  628. @itemize
  629. @item interface for system configuration file;
  630. @item interface for system services;
  631. @item commands to display system profile and generations.
  632. @end itemize
  633. @menu
  634. * System From File:: Interface for @code{operating-system} declaration.
  635. * Services:: Interface for system services.
  636. * System Commands:: Other @kbd{M-x guix-@dots{}} related to system.
  637. @end menu
  638. @node System From File
  639. @section System From File
  640. @cindex system
  641. Your system configuration file (for Guix System) contains
  642. @code{operating-system} declaration (@pxref{operating-system
  643. Reference,,, guix, The GNU Guix Reference Manual}).
  644. And Emacs-Guix provides an interface for this @code{operating-system},
  645. where you can look at the packages, services, initrd modules that this
  646. system will install and some other stuff.
  647. @table @kbd
  648. @findex guix-system-from-file
  649. @item guix-system-from-file
  650. Find your system configuration file and look at the system it
  651. provides.
  652. @end table
  653. @node Services
  654. @section Services
  655. @cindex services
  656. If you use Guix System, you may have a wish to become more familiar with
  657. the system services (@pxref{Services,,, guix, The GNU Guix Reference
  658. Manual}). Emacs-Guix provides several commands to display these
  659. services.
  660. @menu
  661. * Service Commands:: @kbd{M-x guix-@dots{}} to show services.
  662. * Service Locations:: Interface for locations of services.
  663. @end menu
  664. @node Service Commands
  665. @subsection Service Commands
  666. The interface for services is very similar to the interface for
  667. packages (@pxref{Packages}). The following commands allows you to
  668. look at the Guix System services.
  669. @table @kbd
  670. @findex guix-all-services
  671. @item M-x guix-all-services
  672. Display all available services.
  673. @findex guix-default-services
  674. @item M-x guix-default-services
  675. Display services from @code{%base-services} (@pxref{Base Services,,,
  676. guix, The GNU Guix Reference Manual}) or @code{%desktop-services}
  677. (@pxref{Desktop Services,,, guix, The GNU Guix Reference Manual}).
  678. You will be prompted in the minibuffer for the variable name
  679. (completions available).
  680. @findex guix-services-by-name
  681. @item M-x guix-services-by-name
  682. Display service(s) with the specified name.
  683. @findex guix-services-by-regexp
  684. @vindex guix-service-search-params
  685. @item M-x guix-services-by-regexp
  686. Search for services by a specified regexp. By default, ``name'' and
  687. ``description'' of the services will be searched. This can be changed
  688. by modifying @code{guix-service-search-params} variable.
  689. @findex guix-services-by-location
  690. @item M-x guix-services-by-location
  691. Display service(s) located in the specified file.
  692. @findex guix-services-from-system-config-file
  693. @item M-x guix-services-from-system-config-file
  694. Display services from the specified file with @code{operating-system}
  695. declaration.
  696. @end table
  697. @node Service Locations
  698. @subsection Service Locations
  699. @cindex service Locations
  700. Similarly to the package locations (@pxref{Package Locations}), you
  701. may look at the service locations:
  702. @table @kbd
  703. @findex guix-service-locations
  704. @item M-x guix-service-locations
  705. Display a list of files with service locations. Press @kbd{@key{RET}}
  706. there to display services placed in the current location.
  707. @findex guix-find-service-location-file
  708. @item M-x guix-find-service-location-file
  709. Open a file with service definitions (press @kbd{@key{TAB}} to choose
  710. the file from a completion list).
  711. @findex guix-find-service-definition
  712. @item M-x guix-find-service-definition
  713. Go to the service location---i.e., open a file with the specified
  714. service and move the point to its definition.
  715. @end table
  716. @node System Commands
  717. @section System Commands
  718. Along with the commands for services and @code{operating-system},
  719. there are commands to look at the system profile
  720. (@file{/var/guix/profiles/system}), its generations and packages
  721. installed in it.
  722. @table @kbd
  723. @findex guix-system-profile
  724. @item M-x guix-system-profile
  725. Display ``info'' interface for the system profile.
  726. @findex guix-system-generations
  727. @item M-x guix-system-generations
  728. @findex guix-last-system-generations
  729. @itemx M-x guix-last-system-generations
  730. @findex guix-system-generations-by-time
  731. @itemx M-x guix-system-generations-by-time
  732. Display generations of the system profile. These commands have the
  733. same meaning as the usual generation commands (@pxref{Generation
  734. Commands}).
  735. @findex guix-installed-system-packages
  736. @item M-x guix-installed-system-packages
  737. Display packages installed in the system profile.
  738. @findex guix-packages-from-system-config-file
  739. @item M-x guix-packages-from-system-config-file
  740. @findex guix-services-from-system-config-file
  741. @item M-x guix-services-from-system-config-file
  742. Display packages/services from the specified system configuration
  743. file. You can also look at these packages/services from the
  744. ``system-info'' interface (@pxref{System From File}).
  745. @end table
  746. @c ----------------------------------------------------------------
  747. @node Store Items
  748. @chapter Store Items
  749. @cindex store items
  750. Your @file{/gnu/store} is full of items, and Emacs-Guix provides
  751. several commands that allow you to look at these items closely. Most
  752. of these commands are analogous to @code{guix gc} shell commands with
  753. the according options (@code{--referrers}, @code{--derivers}, etc.)
  754. (@pxref{Invoking guix gc,,, guix, The GNU Guix Reference Manual}).
  755. @menu
  756. * Store Item Commands:: @kbd{M-x guix-@dots{}} to show store items.
  757. * Store Item Keys:: Key bindings in store item ``list'' buffer.
  758. @end menu
  759. @node Store Item Commands
  760. @section Store Item Commands
  761. @table @kbd
  762. @findex guix-store-item
  763. @item M-x guix-store-item
  764. Display some info on the specified store file.
  765. @findex guix-store-item-referrers
  766. @item M-x guix-store-item-referrers
  767. Display referrers of the specified store file.
  768. @findex guix-store-item-references
  769. @item M-x guix-store-item-references
  770. Display references of the specified store file.
  771. @findex guix-store-item-requisites
  772. @item M-x guix-store-item-requisites
  773. Display requisites of the specified store file.
  774. @findex guix-store-item-derivers
  775. @item M-x guix-store-item-derivers
  776. Display derivers of the specified store file.
  777. @findex guix-store-failures
  778. @item M-x guix-store-failures
  779. Display store items corresponding to cached build failures.
  780. @findex guix-store-live-items
  781. @item M-x guix-store-live-items
  782. Display live store items. Note that this and the next commands may
  783. take a long time if your store is big.
  784. @findex guix-store-dead-items
  785. @item M-x guix-store-dead-items
  786. Display dead store items.
  787. @end table
  788. @node Store Item Keys
  789. @section Store Item Keys
  790. Along with the general ``list'' keys (@pxref{List buffer}), a
  791. ``store-item-list'' buffer additionally provides the following key
  792. bindings:
  793. @table @kbd
  794. @item e
  795. Go to the current store item.
  796. @item d
  797. Mark the current store item for deletion (with prefix, mark all store
  798. items).
  799. @item x
  800. Execute operation on the marked store items---i.e., attempt to delete
  801. them. This is similar to @code{guix gc --delete @dots{}}.
  802. @item z
  803. Show minibuffer message with total size of the marked store items.
  804. @item D
  805. Show derivers of the current (or marked) store item(s).
  806. @item R
  807. Show requisites of the current (or marked) store item(s).
  808. @item f
  809. Show referrers of the current (or marked) store item(s).
  810. @item F
  811. Show references of the current (or marked) store item(s).
  812. @end table
  813. @c ----------------------------------------------------------------
  814. @node Package Licenses
  815. @chapter Package Licenses
  816. @cindex package licenses
  817. If you want to browse the URL of a particular license, or to look at a
  818. list of licenses, you may use the following commands:
  819. @table @kbd
  820. @findex guix-browse-license-url
  821. @item M-x guix-browse-license-url
  822. Choose a license from a completion list to browse its URL using
  823. @code{browse-url} function (@pxref{Browse-URL,,, emacs, The GNU Emacs
  824. Manual}).
  825. @findex guix-licenses
  826. @item M-x guix-licenses
  827. Display a list of available licenses. You can press @kbd{P} key
  828. there to display packages with this license in the same way as
  829. @kbd{M-x@tie{}guix-packages-by-license} would do (@pxref{Package
  830. Commands}).
  831. @findex guix-find-license-location-file
  832. @item M-x guix-find-license-location-file
  833. Open @file{@dots{}/guix/licenses.scm} file.
  834. @findex guix-find-license-definition
  835. @item M-x guix-find-license-definition
  836. Open @file{@dots{}/guix/licenses.scm} and move to the specified license.
  837. @end table
  838. @c ----------------------------------------------------------------
  839. @node Popup Interface
  840. @chapter Popup Interface
  841. If you ever used Magit, you know what ``popup interface'' is
  842. (@pxref{Top,,, magit-popup, Magit-Popup User Manual}). Even if you are
  843. not acquainted with Magit, there should be no worries as it is very
  844. intuitive.
  845. @findex guix
  846. So, @kbd{M-x@tie{}guix} command provides a top-level popup interface
  847. for almost all the available Emacs-Guix commands. It has 2 advantages
  848. comparing with calling @kbd{M-x@tie{}guix-@dots{}} commands directly:
  849. @itemize
  850. @item
  851. There is no need to remember the names of Emacs-Guix commands, as you
  852. can always find them in @kbd{M-x@tie{}guix} and its sub-popups.
  853. @item
  854. It is faster (well, if you know what you are going to call), as it may
  855. serve as a shortcut. For example, instead of calling
  856. @kbd{M-x@tie{}guix-packages-by-name}, you can press:
  857. @kbd{M-x@tie{}guix@tie{}p@tie{}n}.
  858. @end itemize
  859. If you use @kbd{M-x@tie{}guix} often, you may wish to bind it to some
  860. easy accessible key combination, for example, to @kbd{@key{super}-g}:
  861. @example
  862. (global-set-key (kbd "s-g") 'guix)
  863. @end example
  864. @node Guix Popup Interface
  865. @section Guix Popup Interface
  866. @findex guix-command
  867. There is one rather special sub-popup in @kbd{M-x@tie{}guix}. It is
  868. bind to @kbd{c} by default, and you can call it separately with
  869. @kbd{M-x@tie{}guix-command}. It is a popup interface for
  870. @code{guix@tie{}@dots{}} shell commands. It is probably not very
  871. useful, as it provides all the options and flags for all the shell
  872. actions and subcommands, so it may be confusing to see them all at
  873. once. Nevertheless, a description of this thing follows.
  874. When you select an option, you'll be prompted for a value in the
  875. minibuffer. Many values have completions, so don't hesitate to press
  876. @kbd{@key{TAB}} key. Multiple values (for example, packages or lint
  877. checkers) should be separated by commas.
  878. After specifying all options and switches for a command, you may choose
  879. one of the available actions. The following default actions are
  880. available for all commands:
  881. @itemize
  882. @item
  883. Run the command in the Guix REPL. It is faster than running
  884. @code{guix@tie{}@dots{}} command directly in shell, as there is no
  885. need to run another guile process and to load required modules there.
  886. @item
  887. @vindex guix-run-in-shell-function
  888. Run the command in a shell buffer. You can set
  889. @code{guix-run-in-shell-function} variable to fine tune the shell buffer
  890. you want to use.
  891. @item
  892. Add the command line to the kill ring (@pxref{Kill Ring,,, emacs, The
  893. GNU Emacs Manual}).
  894. @end itemize
  895. @cindex graph
  896. Several commands (@command{guix graph}, @command{guix system
  897. shepherd-graph} and @command{guix system extension-graph}) also have a
  898. ``View graph'' action, which allows you to view a generated graph
  899. (@pxref{Graph Configuration}).
  900. @c ----------------------------------------------------------------
  901. @node Prettify Mode
  902. @chapter Guix Prettify Mode
  903. Emacs-Guix also comes with ``guix-prettify.el''. It provides a minor
  904. mode for abbreviating store file names by replacing hash sequences of
  905. symbols with ``@dots{}'':
  906. @example
  907. /gnu/store/72f54nfp6g1hz873w8z3gfcah0h4nl9p-foo-0.1
  908. @result{} /gnu/store/…-foo-0.1
  909. @end example
  910. @table @kbd
  911. @findex guix-prettify-mode
  912. @item M-x guix-prettify-mode
  913. Enable/disable prettifying for the current buffer.
  914. @findex global-guix-prettify-mode
  915. @item M-x global-guix-prettify-mode
  916. Enable/disable prettifying globally.
  917. @end table
  918. If you wish to enable @code{global-guix-prettify-mode} automatically
  919. on Emacs start, you may do it by adding the following line to your
  920. Emacs init file:
  921. @example
  922. (add-hook 'after-init-hook 'global-guix-prettify-mode)
  923. @end example
  924. If you want to enable it only for specific major modes, add it to the
  925. mode hooks (@pxref{Hooks,,, emacs, The GNU Emacs Manual}), for example:
  926. @example
  927. (add-hook 'shell-mode-hook 'guix-prettify-mode)
  928. (add-hook 'dired-mode-hook 'guix-prettify-mode)
  929. @end example
  930. @c ----------------------------------------------------------------
  931. @node Prettify Variables
  932. @chapter Guix Environment Variables Mode
  933. Emacs-Guix provides a major mode based on @code{sh-mode} for
  934. prettifying @file{environment-variables} and @file{profile} files. It
  935. will split all exported variables and separate them with a newline.
  936. All @file{/tmp/guix-build-*-*.drv-*/environment-variables} and
  937. @file{/etc/profile} will be prettified by default.
  938. @vindex guix-env-var-enable-formatting
  939. If you want to disable this prettifying, set
  940. @code{guix-env-var-enable-formatting} variable to nil.
  941. You could also directly use @code{guix-env-var-prettify-buffer} to
  942. prettify the current buffer without changing its major mode and
  943. @code{guix-env-var-prettify-variable} to prettify a variable at
  944. current line.
  945. @table @kbd
  946. @findex guix-env-var-mode
  947. @item M-x guix-env-var-mode
  948. Enable/disable prettifying for the current buffer.
  949. @findex guix-env-var-prettify-buffer
  950. @item M-x guix-env-var-prettify-buffer
  951. Prettify current buffer without switching to @code{guix-env-var-mode}.
  952. @findex guix-env-var-prettify-variable
  953. @item M-x guix-env-var-prettify-variable
  954. Prettify variable assignment at current line.
  955. @end table
  956. @c ----------------------------------------------------------------
  957. @node Build Log Mode
  958. @chapter Build Log Mode
  959. @cindex build log
  960. @findex guix-build-log-mode
  961. Emacs-Guix provides major and minor modes for highlighting build logs.
  962. So when you have a file with a package build output---for example, a
  963. file returned by @command{guix build --log-file @dots{}} command
  964. (@pxref{Invoking guix build,,, guix, The GNU Guix Reference Manual}),
  965. you may call @kbd{M-x@tie{}guix-build-log-mode} command in the buffer
  966. with this file. This major mode highlights some lines specific to
  967. build output and provides the following key bindings:
  968. @table @kbd
  969. @item M-n
  970. Move to the next build phase.
  971. @item M-p
  972. Move to the previous build phase.
  973. @item @key{TAB}
  974. Toggle (show/hide) the body of the current build phase.
  975. @item S-@key{TAB}
  976. Toggle (show/hide) the bodies of all build phases.
  977. @end table
  978. @findex guix-build-log-minor-mode
  979. There is also @kbd{M-x@tie{}guix-build-log-minor-mode} which also
  980. provides the same highlighting and the same key bindings as the major
  981. mode, but prefixed with @kbd{C-c}. You may find this minor mode
  982. useful for shell buffers (@pxref{Interactive Shell,,, emacs, The GNU
  983. Emacs Manual}). It can be enabled there like this:
  984. @example
  985. (add-hook 'shell-mode-hook 'guix-build-log-minor-mode)
  986. @end example
  987. @c ----------------------------------------------------------------
  988. @node Completions
  989. @chapter Shell Completions
  990. @cindex shell
  991. @cindex completions
  992. Another available feature is completing @command{guix} subcommands,
  993. options, packages and other things in @code{shell} (@pxref{Interactive
  994. Shell,,, emacs, The GNU Emacs Manual}) and @code{eshell}
  995. (@pxref{Top,,, eshell, Eshell: The Emacs Shell}) buffers.
  996. It works the same way as other completions do. Just press
  997. @kbd{@key{TAB}} when your intuition tells you.
  998. And here are some examples, where pressing @kbd{@key{TAB}} may
  999. complete something:
  1000. @itemize @w{}
  1001. @item @code{guix pa}@kbd{@key{TAB}}
  1002. @item @code{guix package -}@kbd{@key{TAB}}
  1003. @item @code{guix package --}@kbd{@key{TAB}}
  1004. @item @code{guix package -i gei}@kbd{@key{TAB}}
  1005. @item @code{guix build -L/tm}@kbd{@key{TAB}}
  1006. @item @code{guix build --sy}@kbd{@key{TAB}}
  1007. @item @code{guix build --system=i}@kbd{@key{TAB}}
  1008. @item @code{guix system rec}@kbd{@key{TAB}}
  1009. @item @code{guix lint --checkers=sy}@kbd{@key{TAB}}
  1010. @item @code{guix lint --checkers=synopsis,des}@kbd{@key{TAB}}
  1011. @item @code{guix graph --backend=}@kbd{@key{TAB}}
  1012. @end itemize
  1013. @c ----------------------------------------------------------------
  1014. @node Development
  1015. @chapter Development
  1016. @findex guix-devel-mode
  1017. If you often work with Guix package files, you may want to see some
  1018. highlighting and to have some indentation rules specific for Guix
  1019. keywords. There is a minor mode to help
  1020. you---@kbd{M-x@tie{}guix-devel-mode}. It can be enabled in Scheme
  1021. buffers like this:
  1022. @example
  1023. (add-hook 'scheme-mode-hook 'guix-devel-mode)
  1024. @end example
  1025. Along with highlighting and indentation, this minor mode provides the
  1026. following key bindings:
  1027. @table @kbd
  1028. @item C-c . k
  1029. Copy the name of the current Guile module into kill ring
  1030. (@code{guix-devel-copy-module-as-kill}).
  1031. @item C-c . u
  1032. Use the current Guile module. Often after opening a Scheme file, you
  1033. want to use a module it defines, so you switch to the Geiser REPL and
  1034. write @code{,use (some module)} there. You may just use this command
  1035. instead (@code{guix-devel-use-module}).
  1036. @item C-c . b
  1037. Build a package defined by the current variable definition. The
  1038. building process is run in the current Geiser REPL. If you modified the
  1039. current package definition, don't forget to reevaluate it before calling
  1040. this command---for example, with @kbd{C-M-x} (@pxref{To eval or not to
  1041. eval,,, geiser, Geiser User Manual})
  1042. (@code{guix-devel-build-package-definition}).
  1043. @item C-c . s
  1044. Build a source derivation of the package defined by the current
  1045. variable definition. This command has the same meaning as @code{guix
  1046. build -S} shell command (@pxref{Invoking guix build,,, guix, The GNU
  1047. Guix Reference Manual}) (@code{guix-devel-build-package-source}).
  1048. @item C-c . d
  1049. Download a source of the package defined by the current variable
  1050. definition. This command is the same as running @code{guix download}
  1051. shell command on the package source (@pxref{Invoking guix download,,,
  1052. guix, The GNU Guix Reference Manual})
  1053. (@code{guix-devel-download-package-source}).
  1054. @item C-c . l
  1055. Lint (check) a package defined by the current variable definition
  1056. (@pxref{Invoking guix lint,,, guix, The GNU Guix Reference Manual})
  1057. (@code{guix-devel-lint-package}).
  1058. @item C-c . '
  1059. Edit @code{description} or @code{synopsis} of the current package in
  1060. @code{texinfo-mode} (@code{guix-devel-code-block-edit}).
  1061. @end table
  1062. Unluckily, there is a limitation related to long-running REPL commands.
  1063. When there is a running process in a Geiser REPL, you are not supposed
  1064. to evaluate anything in a scheme buffer, because this will ``freeze''
  1065. the REPL: it will stop producing any output (however, the evaluating
  1066. process will continue---you will just not see any progress anymore). Be
  1067. aware: even moving the point in a scheme buffer may ``break'' the REPL
  1068. if Autodoc (@pxref{Autodoc and friends,,, geiser, Geiser User Manual})
  1069. is enabled (which is the default).
  1070. So you have to postpone editing your scheme buffers until the running
  1071. evaluation will be finished in the REPL.
  1072. Alternatively, to avoid this limitation, you may just run another Geiser
  1073. REPL, and while something is being evaluated in the previous REPL, you
  1074. can continue editing a scheme file with the help of the current one.
  1075. @cindex ffap
  1076. To find a patch file at point with @kbd{M-x ffap} command, you may use:
  1077. @example
  1078. (add-to-list 'ffap-alist '("\\.patch" . guix-devel-ffap-patch))
  1079. @end example
  1080. @c ----------------------------------------------------------------
  1081. @node List/Info Interface
  1082. @chapter List/Info Interface
  1083. As you probably already know, there are multiple commands that display
  1084. various lists (of packages, licenses, etc.). This is so-called
  1085. ``list'' interface. Also you can get the same data displayed in
  1086. ``info'' interface. This chapter describes these interfaces.
  1087. @menu
  1088. * List/Info Keys:: Common keys for both interfaces.
  1089. * ``List'' buffer: List buffer. List-like interface.
  1090. * ``Info'' buffer: Info buffer. Help-like interface.
  1091. @end menu
  1092. @node List/Info Keys
  1093. @section List/Info Keys
  1094. The following keys are available for both ``list'' and ``info''
  1095. interfaces:
  1096. @table @kbd
  1097. @item h
  1098. Show ``hint'' (a message with available key bindings).
  1099. @item l
  1100. @itemx r
  1101. Go backward/forward by the history of the displayed results (this
  1102. history is similar to the history of the Emacs @code{help-mode} or
  1103. @code{Info-mode}).
  1104. @item g
  1105. Revert current buffer: update (receive it again) the currently
  1106. displayed data and redisplay it.
  1107. @item R
  1108. Redisplay current buffer (without updating the data).
  1109. @item ?
  1110. Describe current mode.
  1111. @end table
  1112. Also some buffers provide the following keys:
  1113. @table @kbd
  1114. @item M
  1115. Apply manifest file to the current profile (@pxref{Miscellaneous
  1116. Commands, @code{guix-apply-manifest}}).
  1117. @item C-c C-z
  1118. @cindex Guix REPL
  1119. Go to the Guix REPL (@pxref{The REPL,,, geiser, Geiser User Manual}).
  1120. @end table
  1121. @emph{Hint:} If you need several ``list'' or ``info'' buffers, you can
  1122. simply @kbd{M-x@tie{}clone-buffer} them, and each buffer will have its
  1123. own history.
  1124. @node List buffer
  1125. @section ``List'' buffer
  1126. An interface of a ``list'' buffer is similar to the interface provided
  1127. by ``package.el'' (@pxref{Package Menu,,, emacs, The GNU Emacs Manual}).
  1128. And here are the default key bindings (some of them may be rebound
  1129. to more specific commands):
  1130. @table @kbd
  1131. @item m
  1132. Mark the current entry (with prefix, mark all entries).
  1133. @item u
  1134. Unmark the current entry (with prefix, unmark all entries).
  1135. @item @key{DEL}
  1136. Unmark backward.
  1137. @item @key{RET}
  1138. @itemx i
  1139. Display ``info'' interface for the marked entries (or the current
  1140. entry if nothing is marked).
  1141. @item s
  1142. Sort entries by column specified by the prefix argument (counting from
  1143. 0).
  1144. @end table
  1145. @node Info buffer
  1146. @section ``Info'' buffer
  1147. The interface of an ``info'' buffer is similar to the interface of
  1148. @code{help-mode} (@pxref{Help Mode,,, emacs, The GNU Emacs Manual}),
  1149. or rather @code{Custom-mode} (@pxref{Easy Customization,,, emacs, The
  1150. GNU Emacs Manual}), as it is full of various buttons that can be used
  1151. to open files, browse URLs, do some actions (like installing/removing
  1152. packages), etc.
  1153. @cindex buttons
  1154. As always, you may use @kbd{@key{TAB}} / @kbd{S-@key{TAB}} to move
  1155. between buttons and @kbd{@key{RET}} to press a button, or you can just
  1156. use mouse (@pxref{Mouse References,,, emacs, The GNU Emacs Manual}).
  1157. Finally, you can copy any button label (a link to an URL or a file) by
  1158. pressing @kbd{c} on a button.
  1159. @c ----------------------------------------------------------------
  1160. @node Configuration
  1161. @chapter Configuration
  1162. @cindex customization group
  1163. There are many variables you can modify to change the appearance or
  1164. behavior of Emacs-Guix. Some of these variables are described in this
  1165. section. Also you can use Custom Interface (@pxref{Easy
  1166. Customization,,, emacs, The GNU Emacs Manual}) to explore/set
  1167. variables and faces---@kbd{M-x@tie{}customize-group @key{RET} guix}.
  1168. @menu
  1169. * Graph Configuration:: Set external viewer for graphs, etc.
  1170. * Guile and Build Options:: Settings for Guix REPL, Guile, etc.
  1171. * List/Info Configuration:: Variables for various interfaces.
  1172. * Buffer Names:: Names of Guix buffers.
  1173. * Keymaps:: Configuring key bindings.
  1174. * Miscellaneous Configuration:: Other configuration variables.
  1175. @end menu
  1176. @node Graph Configuration
  1177. @section Graph Configuration
  1178. @cindex graph
  1179. Some commands may display a graph image. Currently Guix provides 2
  1180. graph backends (@pxref{Invoking guix graph,,, guix, The GNU Guix
  1181. Reference Manual}):
  1182. @table @code
  1183. @item d3js
  1184. Such graph will be displayed in your browser using @code{browse-url}
  1185. function (@pxref{Browse-URL,,, emacs, The GNU Emacs Manual}).
  1186. @item graphviz
  1187. Such graph will be displayed inside Emacs by default, but this can be
  1188. configured @dots{}
  1189. @end table
  1190. @vindex guix-find-file-function
  1191. @dots{} Graphs are opened using @code{guix-find-file-function}, so if
  1192. you want to use an external viewer, you need to set this variable.
  1193. Probably the easiest way to set an external viewer is to use a
  1194. functionality provided by the Org Mode. For example, if you want to
  1195. open the generated graphs (PNG files) with @code{sxiv} image viewer,
  1196. you can do it like this:
  1197. @example
  1198. (setq guix-find-file-function 'org-open-file)
  1199. (add-to-list 'org-file-apps '("\\.png\\'" . "sxiv %s"))
  1200. @end example
  1201. Now some deeper details and configuration options.
  1202. @vindex guix-dot-program
  1203. @vindex guix-dot-default-arguments
  1204. @vindex guix-dot-file-name-function
  1205. The @code{graphviz} graph is converted into an image file using
  1206. @command{dot} command specified by @code{guix-dot-program} and
  1207. @code{guix-dot-default-arguments} variables. By default, a PNG file is
  1208. generated and saved as @file{/tmp/emacs-guix-XXXXXX/graph-XXXXXX.png}.
  1209. If you want to change an output format (for example, into PDF), you also
  1210. need to change @code{guix-dot-file-name-function} (to make @code{.pdf}
  1211. extension of the output file). This can be done like this:
  1212. @example
  1213. (defun my-guix-pdf-graph ()
  1214. "/tmp/my-current-guix-graph.pdf")
  1215. (setq guix-dot-default-arguments '("-Tpdf")
  1216. guix-dot-file-name-function 'my-guix-pdf-graph)
  1217. @end example
  1218. @node Guile and Build Options
  1219. @section Guile and Build Options
  1220. @table @code
  1221. @vindex guix-guile-program
  1222. @item guix-guile-program
  1223. If you have some special needs for starting a Guile process, you may
  1224. set this variable. For example, by default, Guile is started with
  1225. @code{--no-auto-compile} flag (because auto-compilation may take a
  1226. very long time), so if you just want @code{guile} without any flags,
  1227. you may just use:
  1228. @example
  1229. (setq guix-guile-program "guile")
  1230. @end example
  1231. @vindex guix-load-path
  1232. @vindex guix-load-compiled-path
  1233. @item guix-load-path
  1234. @itemx guix-load-compiled-path
  1235. Directory or a list of directories prepended to Guile's
  1236. @code{%load-path} and @code{%load-compiled-path} (@pxref{Load Paths,,,
  1237. guile, The GNU Guile Reference Manual}).
  1238. If you use Guix from a git checkout (@pxref{Running Guix Before It Is
  1239. Installed,,, guix, The GNU Guix Reference Manual}), you may want
  1240. Emacs-Guix to use the same guix from git. All you need is to point
  1241. Emacs-Guix to this checkout:
  1242. @example
  1243. (setq guix-load-path "/path/to/guix-git-dir")
  1244. @end example
  1245. Note that setting @code{guix-load-compiled-path} is not needed when
  1246. Scheme (@code{.scm}) and compiled (@code{.go}) files are placed in the
  1247. same directories.
  1248. @vindex guix-use-substitutes
  1249. @item guix-use-substitutes
  1250. Has the same meaning as @code{--no-substitutes} option
  1251. (@pxref{Invoking guix build,,, guix, The GNU Guix Reference
  1252. Manual})---i.e., when non-nil, substitutes are enabled.
  1253. @vindex guix-dry-run
  1254. @item guix-dry-run
  1255. Has the same meaning as @code{--dry-run} option (@pxref{Invoking guix
  1256. build,,, guix, The GNU Guix Reference Manual})---i.e., when non-nil,
  1257. do not build the derivations.
  1258. @cindex Guix REPL
  1259. @vindex guix-repl-use-server
  1260. @item guix-repl-use-server
  1261. By default, along with the main Guix REPL, an additional (internal)
  1262. REPL is started. This allows you to display packages, generations and
  1263. to receive other info from the Scheme side, while there is some active
  1264. process in the main Guix REPL (e.g., while downloading or building
  1265. packages). If you don't want to have the second REPL, set this
  1266. variable to nil.
  1267. @vindex guix-repl-use-latest
  1268. @item guix-repl-use-latest
  1269. Set this variable to nil, if you don't want to use the latest Guix
  1270. code received with @code{guix pull} command (@pxref{Invoking guix
  1271. pull,,, guix, The GNU Guix Reference Manual}).
  1272. @end table
  1273. @node List/Info Configuration
  1274. @section List/Info Configuration
  1275. If you wish to change the appearance of various ``list'' and ``info''
  1276. buffers (@pxref{List/Info Interface}), you may look at
  1277. @code{guix-ENTRY-TYPE-BUFFER-TYPE-@dots{}} variables. Here,
  1278. @dfn{BUFFER-TYPE} is either @code{list} or @code{info}, and
  1279. @dfn{ENTRY-TYPE} is one of the following:
  1280. @table @code
  1281. @item package
  1282. @item package-location
  1283. @item output
  1284. @item profile
  1285. @item generation
  1286. @item system
  1287. @item system-generation
  1288. @item service
  1289. @item service-location
  1290. @item license
  1291. @end table
  1292. @vindex guix-ENTRY-TYPE-BUFFER-TYPE-format
  1293. The main variable of them is
  1294. @code{guix-ENTRY-TYPE-BUFFER-TYPE-format}: it defines what parameters,
  1295. in what order and in what way are displayed. You are welcome to play
  1296. with these ``format'' variables and to explore the other ones.
  1297. @node Buffer Names
  1298. @section Buffer Names
  1299. Default names of various Emacs-Guix buffers (``*Guix@tie{}@dots{}*'')
  1300. may be changed with the following variables:
  1301. @table @code
  1302. @vindex guix-ENTRY-TYPE-BUFFER-TYPE-buffer-name
  1303. @item guix-ENTRY-TYPE-BUFFER-TYPE-buffer-name
  1304. @xref{List/Info Configuration}, for the meaning of @code{ENTRY-TYPE}
  1305. and @code{BUFFER-TYPE}.
  1306. @vindex guix-ui-buffer-name-function
  1307. @item guix-ui-buffer-name-function
  1308. By default, many Guix buffers contain profile name (e.g., @code{*Guix
  1309. Packages: <profile>*}). This variable allows you to control how this
  1310. profile name is displayed. If you want to remove profile name from
  1311. the buffer names, you can do it like this:
  1312. @example
  1313. (setq guix-ui-buffer-name-function 'guix-ui-buffer-name-simple)
  1314. @end example
  1315. @vindex guix-repl-buffer-name
  1316. @item guix-repl-buffer-name
  1317. @vindex guix-internal-repl-buffer-name
  1318. @item guix-internal-repl-buffer-name
  1319. @vindex guix-search-paths-buffer-name
  1320. @item guix-search-paths-buffer-name
  1321. @vindex guix-help-buffer-name
  1322. @item guix-help-buffer-name
  1323. @vindex guix-about-buffer-name
  1324. @item guix-about-buffer-name
  1325. @end table
  1326. @node Keymaps
  1327. @section Keymaps
  1328. If you want to change default key bindings, look at the following
  1329. keymaps (@pxref{Init Rebinding,,, emacs, The GNU Emacs Manual}):
  1330. @table @code
  1331. @vindex guix-ui-map
  1332. @item guix-ui-map
  1333. Parent keymap with general keys for buffers used for Guix package
  1334. management.
  1335. @vindex guix-ENTRY-TYPE-BUFFER-TYPE-mode-map
  1336. @item guix-ENTRY-TYPE-BUFFER-TYPE-mode-map
  1337. @xref{List/Info Configuration}, for the meaning of @code{ENTRY-TYPE}
  1338. and @code{BUFFER-TYPE}.
  1339. @vindex guix-build-log-common-map
  1340. @item guix-build-log-common-map
  1341. @vindex guix-build-log-mode-map
  1342. @item guix-build-log-mode-map
  1343. @vindex guix-build-log-minor-mode-map
  1344. @item guix-build-log-minor-mode-map
  1345. @vindex guix-devel-keys-map
  1346. @item guix-devel-keys-map
  1347. @vindex guix-devel-mode-map
  1348. @item guix-devel-mode-map
  1349. @end table
  1350. @node Miscellaneous Configuration
  1351. @section Miscellaneous Configuration
  1352. @table @code
  1353. @vindex guix-support-dired
  1354. @item guix-support-dired
  1355. Some Emacs-Guix commands (for example, @kbd{M-x guix-hash} or @kbd{M-x
  1356. guix-package-from-file}) may or may not support @code{dired-mode}
  1357. (@pxref{Dired,,, emacs, The GNU Emacs Manual}). By default, whenever
  1358. you run them in a Dired buffer, they will use the file name at
  1359. point---i.e., you will not be prompted for it. If you wish to disable
  1360. this feature, set @code{guix-support-dired} variable to nil.
  1361. @vindex guix-file-size-string-function
  1362. @item guix-file-size-string-function
  1363. You may meet a string with file size in several places, in particular,
  1364. in interface for store items (@pxref{Store Items}). By default, this
  1365. string looks like this: @samp{96.5k (98765 bytes)}. You can modify
  1366. this format by using your own function, for example:
  1367. @example
  1368. (defun my-guix-file-size-string (size)
  1369. (file-size-human-readable size 'si))
  1370. (setq guix-file-size-string-function 'my-guix-file-size-string)
  1371. @end example
  1372. @end table
  1373. @c ----------------------------------------------------------------
  1374. @node Miscellaneous Commands
  1375. @chapter Miscellaneous Commands
  1376. And some more commands that were not covered by the other chapters.
  1377. @table @kbd
  1378. @findex guix-report-bug
  1379. @item M-x guix-report-bug
  1380. Open a mail buffer to report a bug for GNU Guix similarly to
  1381. @kbd{M-x@tie{}report-emacs-bug} command.
  1382. @findex guix-set-emacs-environment
  1383. @item M-x guix-set-emacs-environment
  1384. Set current Emacs environment according to a specified profile. Note
  1385. that there is no way to restore the original environment (you have to
  1386. restart Emacs if you wish to do it).
  1387. @findex guix-pull
  1388. @item M-x guix-pull
  1389. It is the same as @command{guix pull} shell command (@pxref{Invoking
  1390. guix pull,,, guix, The GNU Guix Reference Manual}). With @kbd{C-u},
  1391. make it verbose.
  1392. @cindex Guix REPL
  1393. Once @command{guix pull} has succeeded, the Guix REPL is
  1394. restarted@footnote{Note that name/version pairs cannot be used to
  1395. identify packages (because a name is not necessarily unique), so
  1396. Emacs-Guix uses special identifiers that live only during a guile
  1397. session, so if the Guix REPL was restarted, you may want to revert
  1398. ``list'' buffer (by pressing @kbd{g}).}. This allows you to keep
  1399. using the Emacs interface with the updated Guix code.
  1400. @findex guix-hash
  1401. @item M-x guix-hash
  1402. Compute and copy to the kill ring (@pxref{Yanking,,, emacs, The GNU
  1403. Emacs Manual}) the SHA256 hash of a file (@pxref{Invoking guix hash,,,
  1404. guix, The GNU Guix Reference Manual}). With @kbd{C-u}, prompt for a
  1405. hash format.
  1406. If you call this command on a directory, its hash will be calculated
  1407. recursively without version-controlled files (so you can use this hash
  1408. in a package recipe).
  1409. @end table
  1410. @c ----------------------------------------------------------------
  1411. @node Help
  1412. @chapter Help
  1413. So many commands, so many buffers! This chapter describes few more
  1414. commands that should help you not to get lost.
  1415. @table @kbd
  1416. @findex guix-help
  1417. @item M-x guix-help
  1418. Display a buffer with the summary of the available Emacs-Guix
  1419. commands. Buttons in this buffer allow you to run commands and to
  1420. look at their docstrings and manual entries.
  1421. @findex guix-info
  1422. @item M-x guix-info
  1423. Show this Emacs-Guix info manual. With prefix argument, show the Guix
  1424. info manual.
  1425. @findex guix-switch-to-buffer
  1426. @item M-x guix-switch-to-buffer
  1427. Switch to one of the Emacs-Guix buffers. This is like a usual
  1428. @code{switch-to-buffer} (bound to @kbd{C-x b} by default), except it
  1429. completes only Guix buffers names. If you are going to use this
  1430. command, it is probably better to bind it to some key, for example:
  1431. @example
  1432. (global-set-key (kbd "C-x B") 'guix-switch-to-buffer)
  1433. @end example
  1434. @findex guix-extended-command
  1435. @item M-x guix-extended-command
  1436. Run Emacs-Guix command. This is like @kbd{M-x} (@pxref{M-x,,, emacs,
  1437. The GNU Emacs Manual}), except it completes only Guix command names.
  1438. And again, this is not a very useful command unless it is bound to
  1439. some key, for example:
  1440. @example
  1441. (global-set-key (kbd "M-X") 'guix-extended-command)
  1442. @end example
  1443. @end table
  1444. @c ----------------------------------------------------------------
  1445. @node Concept Index
  1446. @unnumbered Concept Index
  1447. @printindex cp
  1448. @node Command Index
  1449. @unnumbered Command Index
  1450. @printindex fn
  1451. @node Variable Index
  1452. @unnumbered Variable Index
  1453. @printindex vr
  1454. @bye