1<chapter xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
3 xml:id="chap-package-notes">
4 <title>Package Notes</title>
5 <para>
6 This chapter contains information about how to use and maintain the Nix
7 expressions for a number of specific packages, such as the Linux kernel or
8 X.org.
9 </para>
10<!--============================================================-->
11 <section xml:id="sec-linux-kernel">
12 <title>Linux kernel</title>
13
14 <para>
15 The Nix expressions to build the Linux kernel are in
16 <link
17xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel"><filename>pkgs/os-specific/linux/kernel</filename></link>.
18 </para>
19
20 <para>
21 The function that builds the kernel has an argument
22 <varname>kernelPatches</varname> which should be a list of <literal>{name,
23 patch, extraConfig}</literal> attribute sets, where <varname>name</varname>
24 is the name of the patch (which is included in the kernel’s
25 <varname>meta.description</varname> attribute), <varname>patch</varname> is
26 the patch itself (possibly compressed), and <varname>extraConfig</varname>
27 (optional) is a string specifying extra options to be concatenated to the
28 kernel configuration file (<filename>.config</filename>).
29 </para>
30
31 <para>
32 The kernel derivation exports an attribute <varname>features</varname>
33 specifying whether optional functionality is or isn’t enabled. This is
34 used in NixOS to implement kernel-specific behaviour. For instance, if the
35 kernel has the <varname>iwlwifi</varname> feature (i.e. has built-in support
36 for Intel wireless chipsets), then NixOS doesn’t have to build the
37 external <varname>iwlwifi</varname> package:
38<programlisting>
39modulesTree = [kernel]
40 ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi
41 ++ ...;
42</programlisting>
43 </para>
44
45 <para>
46 How to add a new (major) version of the Linux kernel to Nixpkgs:
47 <orderedlist>
48 <listitem>
49 <para>
50 Copy the old Nix expression (e.g. <filename>linux-2.6.21.nix</filename>)
51 to the new one (e.g. <filename>linux-2.6.22.nix</filename>) and update
52 it.
53 </para>
54 </listitem>
55 <listitem>
56 <para>
57 Add the new kernel to <filename>all-packages.nix</filename> (e.g., create
58 an attribute <varname>kernel_2_6_22</varname>).
59 </para>
60 </listitem>
61 <listitem>
62 <para>
63 Now we’re going to update the kernel configuration. First unpack the
64 kernel. Then for each supported platform (<literal>i686</literal>,
65 <literal>x86_64</literal>, <literal>uml</literal>) do the following:
66 <orderedlist>
67 <listitem>
68 <para>
69 Make an copy from the old config (e.g.
70 <filename>config-2.6.21-i686-smp</filename>) to the new one (e.g.
71 <filename>config-2.6.22-i686-smp</filename>).
72 </para>
73 </listitem>
74 <listitem>
75 <para>
76 Copy the config file for this platform (e.g.
77 <filename>config-2.6.22-i686-smp</filename>) to
78 <filename>.config</filename> in the kernel source tree.
79 </para>
80 </listitem>
81 <listitem>
82 <para>
83 Run <literal>make oldconfig
84 ARCH=<replaceable>{i386,x86_64,um}</replaceable></literal> and answer
85 all questions. (For the uml configuration, also add
86 <literal>SHELL=bash</literal>.) Make sure to keep the configuration
87 consistent between platforms (i.e. don’t enable some feature on
88 <literal>i686</literal> and disable it on <literal>x86_64</literal>).
89 </para>
90 </listitem>
91 <listitem>
92 <para>
93 If needed you can also run <literal>make menuconfig</literal>:
94<screen>
95$ nix-env -i ncurses
96$ export NIX_CFLAGS_LINK=-lncurses
97$ make menuconfig ARCH=<replaceable>arch</replaceable></screen>
98 </para>
99 </listitem>
100 <listitem>
101 <para>
102 Copy <filename>.config</filename> over the new config file (e.g.
103 <filename>config-2.6.22-i686-smp</filename>).
104 </para>
105 </listitem>
106 </orderedlist>
107 </para>
108 </listitem>
109 <listitem>
110 <para>
111 Test building the kernel: <literal>nix-build -A kernel_2_6_22</literal>.
112 If it compiles, ship it! For extra credit, try booting NixOS with it.
113 </para>
114 </listitem>
115 <listitem>
116 <para>
117 It may be that the new kernel requires updating the external kernel
118 modules and kernel-dependent packages listed in the
119 <varname>linuxPackagesFor</varname> function in
120 <filename>all-packages.nix</filename> (such as the NVIDIA drivers, AUFS,
121 etc.). If the updated packages aren’t backwards compatible with older
122 kernels, you may need to keep the older versions around.
123 </para>
124 </listitem>
125 </orderedlist>
126 </para>
127 </section>
128<!--============================================================-->
129 <section xml:id="sec-xorg">
130 <title>X.org</title>
131
132 <para>
133 The Nix expressions for the X.org packages reside in
134 <filename>pkgs/servers/x11/xorg/default.nix</filename>. This file is
135 automatically generated from lists of tarballs in an X.org release. As such
136 it should not be modified directly; rather, you should modify the lists, the
137 generator script or the file
138 <filename>pkgs/servers/x11/xorg/overrides.nix</filename>, in which you can
139 override or add to the derivations produced by the generator.
140 </para>
141
142 <para>
143 The generator is invoked as follows:
144<screen>
145$ cd pkgs/servers/x11/xorg
146$ cat tarballs-7.5.list extra.list old.list \
147 | perl ./generate-expr-from-tarballs.pl
148</screen>
149 For each of the tarballs in the <filename>.list</filename> files, the script
150 downloads it, unpacks it, and searches its <filename>configure.ac</filename>
151 and <filename>*.pc.in</filename> files for dependencies. This information is
152 used to generate <filename>default.nix</filename>. The generator caches
153 downloaded tarballs between runs. Pay close attention to the <literal>NOT
154 FOUND: <replaceable>name</replaceable></literal> messages at the end of the
155 run, since they may indicate missing dependencies. (Some might be optional
156 dependencies, however.)
157 </para>
158
159 <para>
160 A file like <filename>tarballs-7.5.list</filename> contains all tarballs in
161 a X.org release. It can be generated like this:
162<screen>
163$ export i="mirror://xorg/X11R7.4/src/everything/"
164$ cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \
165 | perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'i'}$2\n"; }; }' \
166 | sort > tarballs-7.4.list
167</screen>
168 <filename>extra.list</filename> contains libraries that aren’t part of
169 X.org proper, but are closely related to it, such as
170 <literal>libxcb</literal>. <filename>old.list</filename> contains some
171 packages that were removed from X.org, but are still needed by some people
172 or by other packages (such as <varname>imake</varname>).
173 </para>
174
175 <para>
176 If the expression for a package requires derivation attributes that the
177 generator cannot figure out automatically (say, <varname>patches</varname>
178 or a <varname>postInstall</varname> hook), you should modify
179 <filename>pkgs/servers/x11/xorg/overrides.nix</filename>.
180 </para>
181 </section>
182<!--============================================================-->
183<!--
184<section xml:id="sec-package-notes-gnome">
185 <title>Gnome</title>
186 <para>* Expression is auto-generated</para>
187 <para>* How to update</para>
188</section>
189-->
190<!--============================================================-->
191<!--
192<section xml:id="sec-package-notes-gcc">
193 <title>GCC</title>
194 <para>…</para>
195</section>
196-->
197<!--============================================================-->
198 <section xml:id="sec-eclipse">
199 <title>Eclipse</title>
200
201 <para>
202 The Nix expressions related to the Eclipse platform and IDE are in
203 <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/eclipse"><filename>pkgs/applications/editors/eclipse</filename></link>.
204 </para>
205
206 <para>
207 Nixpkgs provides a number of packages that will install Eclipse in its
208 various forms, these range from the bare-bones Eclipse Platform to the more
209 fully featured Eclipse SDK or Scala-IDE packages and multiple version are
210 often available. It is possible to list available Eclipse packages by
211 issuing the command:
212<screen>
213$ nix-env -f '<nixpkgs>' -qaP -A eclipses --description
214</screen>
215 Once an Eclipse variant is installed it can be run using the
216 <command>eclipse</command> command, as expected. From within Eclipse it is
217 then possible to install plugins in the usual manner by either manually
218 specifying an Eclipse update site or by installing the Marketplace Client
219 plugin and using it to discover and install other plugins. This installation
220 method provides an Eclipse installation that closely resemble a manually
221 installed Eclipse.
222 </para>
223
224 <para>
225 If you prefer to install plugins in a more declarative manner then Nixpkgs
226 also offer a number of Eclipse plugins that can be installed in an
227 <emphasis>Eclipse environment</emphasis>. This type of environment is
228 created using the function <varname>eclipseWithPlugins</varname> found
229 inside the <varname>nixpkgs.eclipses</varname> attribute set. This function
230 takes as argument <literal>{ eclipse, plugins ? [], jvmArgs ? [] }</literal>
231 where <varname>eclipse</varname> is a one of the Eclipse packages described
232 above, <varname>plugins</varname> is a list of plugin derivations, and
233 <varname>jvmArgs</varname> is a list of arguments given to the JVM running
234 the Eclipse. For example, say you wish to install the latest Eclipse
235 Platform with the popular Eclipse Color Theme plugin and also allow Eclipse
236 to use more RAM. You could then add
237<screen>
238packageOverrides = pkgs: {
239 myEclipse = with pkgs.eclipses; eclipseWithPlugins {
240 eclipse = eclipse-platform;
241 jvmArgs = [ "-Xmx2048m" ];
242 plugins = [ plugins.color-theme ];
243 };
244}
245</screen>
246 to your Nixpkgs configuration
247 (<filename>~/.config/nixpkgs/config.nix</filename>) and install it by
248 running <command>nix-env -f '<nixpkgs>' -iA myEclipse</command> and
249 afterward run Eclipse as usual. It is possible to find out which plugins are
250 available for installation using <varname>eclipseWithPlugins</varname> by
251 running
252<screen>
253$ nix-env -f '<nixpkgs>' -qaP -A eclipses.plugins --description
254</screen>
255 </para>
256
257 <para>
258 If there is a need to install plugins that are not available in Nixpkgs then
259 it may be possible to define these plugins outside Nixpkgs using the
260 <varname>buildEclipseUpdateSite</varname> and
261 <varname>buildEclipsePlugin</varname> functions found in the
262 <varname>nixpkgs.eclipses.plugins</varname> attribute set. Use the
263 <varname>buildEclipseUpdateSite</varname> function to install a plugin
264 distributed as an Eclipse update site. This function takes <literal>{ name,
265 src }</literal> as argument where <literal>src</literal> indicates the
266 Eclipse update site archive. All Eclipse features and plugins within the
267 downloaded update site will be installed. When an update site archive is not
268 available then the <varname>buildEclipsePlugin</varname> function can be
269 used to install a plugin that consists of a pair of feature and plugin JARs.
270 This function takes an argument <literal>{ name, srcFeature, srcPlugin
271 }</literal> where <literal>srcFeature</literal> and
272 <literal>srcPlugin</literal> are the feature and plugin JARs, respectively.
273 </para>
274
275 <para>
276 Expanding the previous example with two plugins using the above functions we
277 have
278<screen>
279packageOverrides = pkgs: {
280 myEclipse = with pkgs.eclipses; eclipseWithPlugins {
281 eclipse = eclipse-platform;
282 jvmArgs = [ "-Xmx2048m" ];
283 plugins = [
284 plugins.color-theme
285 (plugins.buildEclipsePlugin {
286 name = "myplugin1-1.0";
287 srcFeature = fetchurl {
288 url = "http://…/features/myplugin1.jar";
289 sha256 = "123…";
290 };
291 srcPlugin = fetchurl {
292 url = "http://…/plugins/myplugin1.jar";
293 sha256 = "123…";
294 };
295 });
296 (plugins.buildEclipseUpdateSite {
297 name = "myplugin2-1.0";
298 src = fetchurl {
299 stripRoot = false;
300 url = "http://…/myplugin2.zip";
301 sha256 = "123…";
302 };
303 });
304 ];
305 };
306}
307</screen>
308 </para>
309 </section>
310 <section xml:id="sec-elm">
311 <title>Elm</title>
312
313 <para>
314 The Nix expressions for Elm reside in
315 <filename>pkgs/development/compilers/elm</filename>. They are generated
316 automatically by <command>update-elm.rb</command> script. One should specify
317 versions of Elm packages inside the script, clear the
318 <filename>packages</filename> directory and run the script from inside it.
319 <literal>elm-reactor</literal> is special because it also has Elm package
320 dependencies. The process is not automated very much for now -- you should
321 get the <literal>elm-reactor</literal> source tree (e.g. with
322 <command>nix-shell</command>) and run <command>elm2nix.rb</command> inside
323 it. Place the resulting <filename>package.nix</filename> file into
324 <filename>packages/elm-reactor-elm.nix</filename>.
325 </para>
326 </section>
327 <section xml:id="sec-shell-helpers">
328 <title>Interactive shell helpers</title>
329
330 <para>
331 Some packages provide the shell integration to be more useful. But unlike
332 other systems, nix doesn't have a standard share directory location. This is
333 why a bunch <command>PACKAGE-share</command> scripts are shipped that print
334 the location of the corresponding shared folder. Current list of such
335 packages is as following:
336 <itemizedlist>
337 <listitem>
338 <para>
339 <literal>autojump</literal>: <command>autojump-share</command>
340 </para>
341 </listitem>
342 <listitem>
343 <para>
344 <literal>fzf</literal>: <command>fzf-share</command>
345 </para>
346 </listitem>
347 </itemizedlist>
348 E.g. <literal>autojump</literal> can then used in the .bashrc like this:
349<screen>
350 source "$(autojump-share)/autojump.bash"
351</screen>
352 </para>
353 </section>
354 <section xml:id="sec-steam">
355 <title>Steam</title>
356
357 <section xml:id="sec-steam-nix">
358 <title>Steam in Nix</title>
359
360 <para>
361 Steam is distributed as a <filename>.deb</filename> file, for now only as
362 an i686 package (the amd64 package only has documentation). When unpacked,
363 it has a script called <filename>steam</filename> that in ubuntu (their
364 target distro) would go to <filename>/usr/bin </filename>. When run for the
365 first time, this script copies some files to the user's home, which include
366 another script that is the ultimate responsible for launching the steam
367 binary, which is also in $HOME.
368 </para>
369
370 <para>
371 Nix problems and constraints:
372 <itemizedlist>
373 <listitem>
374 <para>
375 We don't have <filename>/bin/bash</filename> and many scripts point
376 there. Similarly for <filename>/usr/bin/python</filename> .
377 </para>
378 </listitem>
379 <listitem>
380 <para>
381 We don't have the dynamic loader in <filename>/lib </filename>.
382 </para>
383 </listitem>
384 <listitem>
385 <para>
386 The <filename>steam.sh</filename> script in $HOME can not be patched, as
387 it is checked and rewritten by steam.
388 </para>
389 </listitem>
390 <listitem>
391 <para>
392 The steam binary cannot be patched, it's also checked.
393 </para>
394 </listitem>
395 </itemizedlist>
396 </para>
397
398 <para>
399 The current approach to deploy Steam in NixOS is composing a FHS-compatible
400 chroot environment, as documented
401 <link xlink:href="http://sandervanderburg.blogspot.nl/2013/09/composing-fhs-compatible-chroot.html">here</link>.
402 This allows us to have binaries in the expected paths without disrupting
403 the system, and to avoid patching them to work in a non FHS environment.
404 </para>
405 </section>
406
407 <section xml:id="sec-steam-play">
408 <title>How to play</title>
409
410 <para>
411 For 64-bit systems it's important to have
412<programlisting>hardware.opengl.driSupport32Bit = true;</programlisting>
413 in your <filename>/etc/nixos/configuration.nix</filename>. You'll also need
414<programlisting>hardware.pulseaudio.support32Bit = true;</programlisting>
415 if you are using PulseAudio - this will enable 32bit ALSA apps integration.
416 To use the Steam controller, you need to add
417<programlisting>services.udev.extraRules = ''
418 SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666"
419 KERNEL=="uinput", MODE="0660", GROUP="users", OPTIONS+="static_node=uinput"
420 '';</programlisting>
421 to your configuration.
422 </para>
423 </section>
424
425 <section xml:id="sec-steam-troub">
426 <title>Troubleshooting</title>
427
428 <para>
429 <variablelist>
430 <varlistentry>
431 <term>
432 Steam fails to start. What do I do?
433 </term>
434 <listitem>
435 <para>
436 Try to run
437<programlisting>strace steam</programlisting>
438 to see what is causing steam to fail.
439 </para>
440 </listitem>
441 </varlistentry>
442 <varlistentry>
443 <term>
444 Using the FOSS Radeon or nouveau (nvidia) drivers
445 </term>
446 <listitem>
447 <itemizedlist>
448 <listitem>
449 <para>
450 The <literal>newStdcpp</literal> parameter was removed since NixOS
451 17.09 and should not be needed anymore.
452 </para>
453 </listitem>
454 <listitem>
455 <para>
456 Steam ships statically linked with a version of libcrypto that
457 conflics with the one dynamically loaded by radeonsi_dri.so. If you
458 get the error
459<programlisting>steam.sh: line 713: 7842 Segmentation fault (core dumped)</programlisting>
460 have a look at
461 <link xlink:href="https://github.com/NixOS/nixpkgs/pull/20269">this
462 pull request</link>.
463 </para>
464 </listitem>
465 </itemizedlist>
466 </listitem>
467 </varlistentry>
468 <varlistentry>
469 <term>
470 Java
471 </term>
472 <listitem>
473 <orderedlist>
474 <listitem>
475 <para>
476 There is no java in steam chrootenv by default. If you get a message
477 like
478<programlisting>/home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found</programlisting>
479 You need to add
480<programlisting> steam.override { withJava = true; };</programlisting>
481 to your configuration.
482 </para>
483 </listitem>
484 </orderedlist>
485 </listitem>
486 </varlistentry>
487 </variablelist>
488 </para>
489 </section>
490
491 <section xml:id="sec-steam-run">
492 <title>steam-run</title>
493
494 <para>
495 The FHS-compatible chroot used for steam can also be used to run other
496 linux games that expect a FHS environment. To do it, add
497<programlisting>pkgs.(steam.override {
498 nativeOnly = true;
499 newStdcpp = true;
500 }).run</programlisting>
501 to your configuration, rebuild, and run the game with
502<programlisting>steam-run ./foo</programlisting>
503 </para>
504 </section>
505 </section>
506 <section xml:id="sec-emacs">
507 <title>Emacs</title>
508
509 <section xml:id="sec-emacs-config">
510 <title>Configuring Emacs</title>
511
512 <para>
513 The Emacs package comes with some extra helpers to make it easier to
514 configure. <varname>emacsWithPackages</varname> allows you to manage
515 packages from ELPA. This means that you will not have to install that
516 packages from within Emacs. For instance, if you wanted to use
517 <literal>company</literal>, <literal>counsel</literal>,
518 <literal>flycheck</literal>, <literal>ivy</literal>,
519 <literal>magit</literal>, <literal>projectile</literal>, and
520 <literal>use-package</literal> you could use this as a
521 <filename>~/.config/nixpkgs/config.nix</filename> override:
522 </para>
523
524<screen>
525{
526 packageOverrides = pkgs: with pkgs; {
527 myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
528 company
529 counsel
530 flycheck
531 ivy
532 magit
533 projectile
534 use-package
535 ]));
536 }
537}
538</screen>
539
540 <para>
541 You can install it like any other packages via <command>nix-env -iA
542 myEmacs</command>. However, this will only install those packages. It will
543 not <literal>configure</literal> them for us. To do this, we need to
544 provide a configuration file. Luckily, it is possible to do this from
545 within Nix! By modifying the above example, we can make Emacs load a custom
546 config file. The key is to create a package that provide a
547 <filename>default.el</filename> file in
548 <filename>/share/emacs/site-start/</filename>. Emacs knows to load this
549 file automatically when it starts.
550 </para>
551
552<screen>
553{
554 packageOverrides = pkgs: with pkgs; rec {
555 myEmacsConfig = writeText "default.el" ''
556;; initialize package
557
558(require 'package)
559(package-initialize 'noactivate)
560(eval-when-compile
561 (require 'use-package))
562
563;; load some packages
564
565(use-package company
566 :bind ("<C-tab>" . company-complete)
567 :diminish company-mode
568 :commands (company-mode global-company-mode)
569 :defer 1
570 :config
571 (global-company-mode))
572
573(use-package counsel
574 :commands (counsel-descbinds)
575 :bind (([remap execute-extended-command] . counsel-M-x)
576 ("C-x C-f" . counsel-find-file)
577 ("C-c g" . counsel-git)
578 ("C-c j" . counsel-git-grep)
579 ("C-c k" . counsel-ag)
580 ("C-x l" . counsel-locate)
581 ("M-y" . counsel-yank-pop)))
582
583(use-package flycheck
584 :defer 2
585 :config (global-flycheck-mode))
586
587(use-package ivy
588 :defer 1
589 :bind (("C-c C-r" . ivy-resume)
590 ("C-x C-b" . ivy-switch-buffer)
591 :map ivy-minibuffer-map
592 ("C-j" . ivy-call))
593 :diminish ivy-mode
594 :commands ivy-mode
595 :config
596 (ivy-mode 1))
597
598(use-package magit
599 :defer
600 :if (executable-find "git")
601 :bind (("C-x g" . magit-status)
602 ("C-x G" . magit-dispatch-popup))
603 :init
604 (setq magit-completing-read-function 'ivy-completing-read))
605
606(use-package projectile
607 :commands projectile-mode
608 :bind-keymap ("C-c p" . projectile-command-map)
609 :defer 5
610 :config
611 (projectile-global-mode))
612 '';
613 myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
614 (runCommand "default.el" {} ''
615mkdir -p $out/share/emacs/site-lisp
616cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el
617'')
618 company
619 counsel
620 flycheck
621 ivy
622 magit
623 projectile
624 use-package
625 ]));
626 };
627}
628</screen>
629
630 <para>
631 This provides a fairly full Emacs start file. It will load in addition to
632 the user's presonal config. You can always disable it by passing
633 <command>-q</command> to the Emacs command.
634 </para>
635
636 <para>
637 Sometimes <varname>emacsWithPackages</varname> is not enough, as this
638 package set has some priorities imposed on packages (with the lowest
639 priority assigned to Melpa Unstable, and the highest for packages manually
640 defined in <filename>pkgs/top-level/emacs-packages.nix</filename>). But you
641 can't control this priorities when some package is installed as a
642 dependency. You can override it on per-package-basis, providing all the
643 required dependencies manually - but it's tedious and there is always a
644 possibility that an unwanted dependency will sneak in through some other
645 package. To completely override such a package you can use
646 <varname>overrideScope</varname>.
647 </para>
648
649<screen>
650overrides = super: self: rec {
651 haskell-mode = self.melpaPackages.haskell-mode;
652 ...
653};
654((emacsPackagesNgGen emacs).overrideScope overrides).emacsWithPackages (p: with p; [
655 # here both these package will use haskell-mode of our own choice
656 ghc-mod
657 dante
658])
659</screen>
660 </section>
661 </section>
662 <section xml:id="sec-weechat">
663 <title>Weechat</title>
664
665 <para>
666 Weechat can be configured to include your choice of plugins, reducing its
667 closure size from the default configuration which includes all available
668 plugins. To make use of this functionality, install an expression that
669 overrides its configuration such as
670<programlisting>weechat.override {configure = {availablePlugins, ...}: {
671 plugins = with availablePlugins; [ python perl ];
672 }
673}</programlisting>
674 </para>
675
676 <para>
677 The plugins currently available are <literal>python</literal>,
678 <literal>perl</literal>, <literal>ruby</literal>, <literal>guile</literal>,
679 <literal>tcl</literal> and <literal>lua</literal>.
680 </para>
681
682 <para>
683 The python plugin allows the addition of extra libraries. For instance, the
684 <literal>inotify.py</literal> script in weechat-scripts requires D-Bus or
685 libnotify, and the <literal>fish.py</literal> script requires pycrypto. To
686 use these scripts, use the <literal>python</literal> plugin's
687 <literal>withPackages</literal> attribute:
688<programlisting>weechat.override { configure = {availablePlugins, ...}: {
689 plugins = with availablePlugins; [
690 (python.withPackages (ps: with ps; [ pycrypto python-dbus ]))
691 ];
692 };
693}
694</programlisting>
695 </para>
696
697 <para>
698 In order to also keep all default plugins installed, it is possible to use
699 the following method:
700<programlisting>weechat.override { configure = { availablePlugins, ... }: {
701 plugins = builtins.attrValues (availablePlugins // {
702 python = availablePlugins.python.withPackages (ps: with ps; [ pycrypto python-dbus ]);
703 });
704}; }
705</programlisting>
706 </para>
707 </section>
708 <section xml:id="sec-citrix">
709 <title>Citrix Receiver</title>
710
711 <para>
712 The <link xlink:href="https://www.citrix.com/products/receiver/">Citrix
713 Receiver</link> is a remote desktop viewer which provides access to
714 <link xlink:href="https://www.citrix.com/products/xenapp-xendesktop/">XenDesktop</link>
715 installations.
716 </para>
717
718 <section xml:id="sec-citrix-base">
719 <title>Basic usage</title>
720
721 <para>
722 The tarball archive needs to be downloaded manually as the licenses
723 agreements of the vendor need to be accepted first. This is available at
724 the
725 <link xlink:href="https://www.citrix.com/downloads/citrix-receiver/">download
726 page at citrix.com</link>. Then run <literal>nix-prefetch-url
727 file://$PWD/linuxx64-$version.tar.gz</literal>. With the archive available
728 in the store the package can be built and installed with Nix.
729 </para>
730
731 <para>
732 <emphasis>Note: it's recommended to install <literal>Citrix
733 Receiver</literal> using <literal>nix-env -i</literal> or globally to
734 ensure that the <literal>.desktop</literal> files are installed properly
735 into <literal>$XDG_CONFIG_DIRS</literal>. Otherwise it won't be possible to
736 open <literal>.ica</literal> files automatically from the browser to start
737 a Citrix connection.</emphasis>
738 </para>
739 </section>
740
741 <section xml:id="sec-citrix-custom-certs">
742 <title>Custom certificates</title>
743
744 <para>
745 The <literal>Citrix Receiver</literal> in <literal>nixpkgs</literal> trusts
746 several certificates
747 <link xlink:href="https://curl.haxx.se/docs/caextract.html">from the
748 Mozilla database</link> by default. However several companies using Citrix
749 might require their own corporate certificate. On distros with imperative
750 packaging these certs can be stored easily in
751 <link xlink:href="https://developer-docs.citrix.com/projects/receiver-for-linux-command-reference/en/13.7/"><literal>$ICAROOT</literal></link>,
752 however this directory is a store path in <literal>nixpkgs</literal>. In
753 order to work around this issue the package provides a simple mechanism to
754 add custom certificates without rebuilding the entire package using
755 <literal>symlinkJoin</literal>:
756<programlisting>
757<![CDATA[with import <nixpkgs> { config.allowUnfree = true; };
758let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in
759citrix_receiver.override {
760 inherit extraCerts;
761}]]>
762</programlisting>
763 </para>
764 </section>
765 </section>
766</chapter>