aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/builders/packages/emacs.section.md119
-rw-r--r--doc/builders/packages/emacs.xml131
-rw-r--r--doc/builders/packages/firefox.section.md49
-rw-r--r--doc/builders/packages/index.xml19
-rw-r--r--doc/builders/packages/kakoune.section.md9
-rw-r--r--doc/builders/packages/kakoune.xml12
-rw-r--r--doc/builders/packages/linux.section.md41
-rw-r--r--doc/builders/packages/linux.xml85
-rw-r--r--doc/builders/packages/nginx.section.md11
-rw-r--r--doc/builders/packages/nginx.xml25
-rw-r--r--doc/builders/packages/opengl.section.md15
-rw-r--r--doc/builders/packages/opengl.xml9
-rw-r--r--doc/builders/packages/shell-helpers.section.md12
-rw-r--r--doc/builders/packages/shell-helpers.xml25
-rw-r--r--doc/builders/packages/urxvt.section.md71
-rw-r--r--doc/builders/packages/urxvt.xml115
-rw-r--r--doc/builders/packages/weechat.section.md85
-rw-r--r--doc/builders/packages/weechat.xml85
-rw-r--r--doc/builders/packages/xorg.section.md34
-rw-r--r--doc/builders/packages/xorg.xml34
-rw-r--r--doc/contributing/reviewing-contributions.xml62
-rw-r--r--doc/languages-frameworks/beam.section.md84
-rw-r--r--doc/languages-frameworks/beam.xml159
-rw-r--r--doc/languages-frameworks/coq.section.md40
-rw-r--r--doc/languages-frameworks/coq.xml52
-rw-r--r--doc/languages-frameworks/dotnet.section.md4
-rw-r--r--doc/languages-frameworks/gnome.xml34
-rw-r--r--doc/languages-frameworks/go.section.md140
-rw-r--r--doc/languages-frameworks/go.xml248
-rw-r--r--doc/languages-frameworks/index.xml16
-rw-r--r--doc/languages-frameworks/java.section.md91
-rw-r--r--doc/languages-frameworks/java.xml77
-rw-r--r--doc/languages-frameworks/ocaml.section.md70
-rw-r--r--doc/languages-frameworks/ocaml.xml73
-rw-r--r--doc/languages-frameworks/python.section.md2
-rw-r--r--doc/languages-frameworks/qt.section.md124
-rw-r--r--doc/languages-frameworks/qt.xml149
-rw-r--r--doc/languages-frameworks/ruby.section.md221
-rw-r--r--doc/languages-frameworks/ruby.xml107
-rw-r--r--doc/languages-frameworks/rust.section.md63
-rw-r--r--doc/languages-frameworks/texlive.section.md128
-rw-r--r--doc/languages-frameworks/texlive.xml152
-rw-r--r--doc/stdenv/meta.xml3
-rw-r--r--doc/stdenv/stdenv.xml2
-rw-r--r--doc/using/configuration.xml3
-rw-r--r--doc/using/overlays.xml1
46 files changed, 1309 insertions, 1782 deletions
diff --git a/doc/builders/packages/emacs.section.md b/doc/builders/packages/emacs.section.md
new file mode 100644
index 000000000000..e9b89d086d68
--- /dev/null
+++ b/doc/builders/packages/emacs.section.md
@@ -0,0 +1,119 @@
+# Emacs {#sec-emacs}
+
+## Configuring Emacs {#sec-emacs-config}
+
+The Emacs package comes with some extra helpers to make it easier to configure. `emacsWithPackages` allows you to manage packages from ELPA. This means that you will not have to install that packages from within Emacs. For instance, if you wanted to use `company` `counsel`, `flycheck`, `ivy`, `magit`, `projectile`, and `use-package` you could use this as a `~/.config/nixpkgs/config.nix` override:
+
+```nix
+{
+ packageOverrides = pkgs: with pkgs; {
+ myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
+ company
+ counsel
+ flycheck
+ ivy
+ magit
+ projectile
+ use-package
+ ]));
+ }
+}
+```
+
+You can install it like any other packages via `nix-env -iA myEmacs`. However, this will only install those packages. It will not `configure` them for us. To do this, we need to provide a configuration file. Luckily, it is possible to do this from within Nix! By modifying the above example, we can make Emacs load a custom config file. The key is to create a package that provide a `default.el` file in `/share/emacs/site-start/`. Emacs knows to load this file automatically when it starts.
+
+```nix
+{
+ packageOverrides = pkgs: with pkgs; rec {
+ myEmacsConfig = writeText "default.el" ''
+ ;; initialize package
+
+ (require 'package)
+ (package-initialize 'noactivate)
+ (eval-when-compile
+ (require 'use-package))
+
+ ;; load some packages
+
+ (use-package company
+ :bind ("<C-tab>" . company-complete)
+ :diminish company-mode
+ :commands (company-mode global-company-mode)
+ :defer 1
+ :config
+ (global-company-mode))
+
+ (use-package counsel
+ :commands (counsel-descbinds)
+ :bind (([remap execute-extended-command] . counsel-M-x)
+ ("C-x C-f" . counsel-find-file)
+ ("C-c g" . counsel-git)
+ ("C-c j" . counsel-git-grep)
+ ("C-c k" . counsel-ag)
+ ("C-x l" . counsel-locate)
+ ("M-y" . counsel-yank-pop)))
+
+ (use-package flycheck
+ :defer 2
+ :config (global-flycheck-mode))
+
+ (use-package ivy
+ :defer 1
+ :bind (("C-c C-r" . ivy-resume)
+ ("C-x C-b" . ivy-switch-buffer)
+ :map ivy-minibuffer-map
+ ("C-j" . ivy-call))
+ :diminish ivy-mode
+ :commands ivy-mode
+ :config
+ (ivy-mode 1))
+
+ (use-package magit
+ :defer
+ :if (executable-find "git")
+ :bind (("C-x g" . magit-status)
+ ("C-x G" . magit-dispatch-popup))
+ :init
+ (setq magit-completing-read-function 'ivy-completing-read))
+
+ (use-package projectile
+ :commands projectile-mode
+ :bind-keymap ("C-c p" . projectile-command-map)
+ :defer 5
+ :config
+ (projectile-global-mode))
+ '';
+
+ myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
+ (runCommand "default.el" {} ''
+ mkdir -p $out/share/emacs/site-lisp
+ cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el
+ '')
+ company
+ counsel
+ flycheck
+ ivy
+ magit
+ projectile
+ use-package
+ ]));
+ };
+}
+```
+
+This provides a fairly full Emacs start file. It will load in addition to the user's presonal config. You can always disable it by passing `-q` to the Emacs command.
+
+Sometimes `emacsWithPackages` is not enough, as this package set has some priorities imposed on packages (with the lowest priority assigned to Melpa Unstable, and the highest for packages manually defined in `pkgs/top-level/emacs-packages.nix`). But you can't control this priorities when some package is installed as a dependency. You can override it on per-package-basis, providing all the required dependencies manually - but it's tedious and there is always a possibility that an unwanted dependency will sneak in through some other package. To completely override such a package you can use `overrideScope'`.
+
+```nix
+overrides = self: super: rec {
+ haskell-mode = self.melpaPackages.haskell-mode;
+ ...
+};
+((emacsPackagesGen emacs).overrideScope' overrides).emacsWithPackages
+ (p: with p; [
+ # here both these package will use haskell-mode of our own choice
+ ghc-mod
+ dante
+ ])
+```
diff --git a/doc/builders/packages/emacs.xml b/doc/builders/packages/emacs.xml
deleted file mode 100644
index 9cce7c40863a..000000000000
--- a/doc/builders/packages/emacs.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-emacs">
- <title>Emacs</title>
-
- <section xml:id="sec-emacs-config">
- <title>Configuring Emacs</title>
-
- <para>
- The Emacs package comes with some extra helpers to make it easier to configure. <varname>emacsWithPackages</varname> allows you to manage packages from ELPA. This means that you will not have to install that packages from within Emacs. For instance, if you wanted to use <literal>company</literal>, <literal>counsel</literal>, <literal>flycheck</literal>, <literal>ivy</literal>, <literal>magit</literal>, <literal>projectile</literal>, and <literal>use-package</literal> you could use this as a <filename>~/.config/nixpkgs/config.nix</filename> override:
- </para>
-
-<screen>
-{
- packageOverrides = pkgs: with pkgs; {
- myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
- company
- counsel
- flycheck
- ivy
- magit
- projectile
- use-package
- ]));
- }
-}
-</screen>
-
- <para>
- You can install it like any other packages via <command>nix-env -iA myEmacs</command>. However, this will only install those packages. It will not <literal>configure</literal> them for us. To do this, we need to provide a configuration file. Luckily, it is possible to do this from within Nix! By modifying the above example, we can make Emacs load a custom config file. The key is to create a package that provide a <filename>default.el</filename> file in <filename>/share/emacs/site-start/</filename>. Emacs knows to load this file automatically when it starts.
- </para>
-
-<screen>
-{
- packageOverrides = pkgs: with pkgs; rec {
- myEmacsConfig = writeText "default.el" ''
-;; initialize package
-
-(require 'package)
-(package-initialize 'noactivate)
-(eval-when-compile
- (require 'use-package))
-
-;; load some packages
-
-(use-package company
- :bind ("&lt;C-tab&gt;" . company-complete)
- :diminish company-mode
- :commands (company-mode global-company-mode)
- :defer 1
- :config
- (global-company-mode))
-
-(use-package counsel
- :commands (counsel-descbinds)
- :bind (([remap execute-extended-command] . counsel-M-x)
- ("C-x C-f" . counsel-find-file)
- ("C-c g" . counsel-git)
- ("C-c j" . counsel-git-grep)
- ("C-c k" . counsel-ag)
- ("C-x l" . counsel-locate)
- ("M-y" . counsel-yank-pop)))
-
-(use-package flycheck
- :defer 2
- :config (global-flycheck-mode))
-
-(use-package ivy
- :defer 1
- :bind (("C-c C-r" . ivy-resume)
- ("C-x C-b" . ivy-switch-buffer)
- :map ivy-minibuffer-map
- ("C-j" . ivy-call))
- :diminish ivy-mode
- :commands ivy-mode
- :config
- (ivy-mode 1))
-
-(use-package magit
- :defer
- :if (executable-find "git")
- :bind (("C-x g" . magit-status)
- ("C-x G" . magit-dispatch-popup))
- :init
- (setq magit-completing-read-function 'ivy-completing-read))
-
-(use-package projectile
- :commands projectile-mode
- :bind-keymap ("C-c p" . projectile-command-map)
- :defer 5
- :config
- (projectile-global-mode))
- '';
- myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
- (runCommand "default.el" {} ''
-mkdir -p $out/share/emacs/site-lisp
-cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el
-'')
- company
- counsel
- flycheck
- ivy
- magit
- projectile
- use-package
- ]));
- };
-}
-</screen>
-
- <para>
- This provides a fairly full Emacs start file. It will load in addition to the user's presonal config. You can always disable it by passing <command>-q</command> to the Emacs command.
- </para>
-
- <para>
- Sometimes <varname>emacsWithPackages</varname> is not enough, as this package set has some priorities imposed on packages (with the lowest priority assigned to Melpa Unstable, and the highest for packages manually defined in <filename>pkgs/top-level/emacs-packages.nix</filename>). But you can't control this priorities when some package is installed as a dependency. You can override it on per-package-basis, providing all the required dependencies manually - but it's tedious and there is always a possibility that an unwanted dependency will sneak in through some other package. To completely override such a package you can use <varname>overrideScope'</varname>.
- </para>
-
-<screen>
-overrides = self: super: rec {
- haskell-mode = self.melpaPackages.haskell-mode;
- ...
-};
-((emacsPackagesGen emacs).overrideScope' overrides).emacsWithPackages (p: with p; [
- # here both these package will use haskell-mode of our own choice
- ghc-mod
- dante
-])
-</screen>
- </section>
-</section>
diff --git a/doc/builders/packages/firefox.section.md b/doc/builders/packages/firefox.section.md
new file mode 100644
index 000000000000..28fa3f0dbd7c
--- /dev/null
+++ b/doc/builders/packages/firefox.section.md
@@ -0,0 +1,49 @@
+# Firefox {#sec-firefox}
+
+## Build wrapped Firefox with extensions and policies
+
+The `wrapFirefox` function allows to pass policies, preferences and extension that are available to firefox. With the help of `fetchFirefoxAddon` this allows build a firefox version that already comes with addons pre-installed:
+
+```nix
+{
+ myFirefox = wrapFirefox firefox-unwrapped {
+ nixExtensions = [
+ (fetchFirefoxAddon {
+ name = "ublock";
+ url = "https://addons.mozilla.org/firefox/downloads/file/3679754/ublock_origin-1.31.0-an+fx.xpi";
+ sha256 = "1h768ljlh3pi23l27qp961v1hd0nbj2vasgy11bmcrlqp40zgvnr";
+ })
+ ];
+
+ extraPolicies = {
+ CaptivePortal = false;
+ DisableFirefoxStudies = true;
+ DisablePocket = true;
+ DisableTelemetry = true;
+ DisableFirefoxAccounts = true;
+ FirefoxHome = {
+ Pocket = false;
+ Snippets = false;
+ };
+ UserMessaging = {
+ ExtensionRecommendations = false;
+ SkipOnboarding = true;
+ };
+ };
+
+ extraPrefs = ''
+ // Show more ssl cert infos
+ lockPref("security.identityblock.show_extended_validation", true);
+ '';
+ };
+}
+```
+
+If `nixExtensions != null` then all manually installed addons will be uninstalled from your browser profile.
+To view available enterprise policies visit [enterprise policies](https://github.com/mozilla/policy-templates#enterprisepoliciesenabled)
+or type into the Firefox url bar: `about:policies#documentation`.
+Nix installed addons do not have a valid signature, which is why signature verification is disabled. This does not compromise security because downloaded addons are checksumed and manual addons can't be installed.
+
+## Troubleshooting {#sec-firefox-troubleshooting}
+If addons do not appear installed although they have been defined in your nix configuration file reset the local addon state of your Firefox profile by clicking `help -> restart with addons disabled -> restart -> refresh firefox`. This can happen if you switch from manual addon mode to nix addon mode and then back to manual mode and then again to nix addon mode.
+
diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml
index e20b0c689a80..c7a4aa9f47dc 100644
--- a/doc/builders/packages/index.xml
+++ b/doc/builders/packages/index.xml
@@ -9,17 +9,18 @@
<xi:include href="dlib.xml" />
<xi:include href="eclipse.xml" />
<xi:include href="elm.xml" />
- <xi:include href="emacs.xml" />
+ <xi:include href="emacs.section.xml" />
+ <xi:include href="firefox.section.xml" />
<xi:include href="ibus.xml" />
- <xi:include href="kakoune.xml" />
- <xi:include href="linux.xml" />
+ <xi:include href="kakoune.section.xml" />
+ <xi:include href="linux.section.xml" />
<xi:include href="locales.xml" />
- <xi:include href="nginx.xml" />
- <xi:include href="opengl.xml" />
- <xi:include href="shell-helpers.xml" />
+ <xi:include href="nginx.section.xml" />
+ <xi:include href="opengl.section.xml" />
+ <xi:include href="shell-helpers.section.xml" />
<xi:include href="steam.xml" />
<xi:include href="cataclysm-dda.section.xml" />
- <xi:include href="urxvt.xml" />
- <xi:include href="weechat.xml" />
- <xi:include href="xorg.xml" />
+ <xi:include href="urxvt.section.xml" />
+ <xi:include href="weechat.section.xml" />
+ <xi:include href="xorg.section.xml" />
</chapter>
diff --git a/doc/builders/packages/kakoune.section.md b/doc/builders/packages/kakoune.section.md
new file mode 100644
index 000000000000..8e054777a757
--- /dev/null
+++ b/doc/builders/packages/kakoune.section.md
@@ -0,0 +1,9 @@
+# Kakoune {#sec-kakoune}
+
+Kakoune can be built to autoload plugins:
+
+```nix
+(kakoune.override {
+ plugins = with pkgs.kakounePlugins; [ parinfer-rust ];
+})
+```
diff --git a/doc/builders/packages/kakoune.xml b/doc/builders/packages/kakoune.xml
deleted file mode 100644
index 045dbd0a653b..000000000000
--- a/doc/builders/packages/kakoune.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-kakoune">
- <title>Kakoune</title>
-
- <para>
- Kakoune can be built to autoload plugins:
-<programlisting>(kakoune.override {
- plugins = with pkgs.kakounePlugins; [ parinfer-rust ];
-})</programlisting>
- </para>
-</section>
diff --git a/doc/builders/packages/linux.section.md b/doc/builders/packages/linux.section.md
new file mode 100644
index 000000000000..1b8d6eda749d
--- /dev/null
+++ b/doc/builders/packages/linux.section.md
@@ -0,0 +1,41 @@
+# Linux kernel {#sec-linux-kernel}
+
+The Nix expressions to build the Linux kernel are in [`pkgs/os-specific/linux/kernel`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel).
+
+The function that builds the kernel has an argument `kernelPatches` which should be a list of `{name, patch, extraConfig}` attribute sets, where `name` is the name of the patch (which is included in the kernel’s `meta.description` attribute), `patch` is the patch itself (possibly compressed), and `extraConfig` (optional) is a string specifying extra options to be concatenated to the kernel configuration file (`.config`).
+
+The kernel derivation exports an attribute `features` specifying whether optional functionality is or isn’t enabled. This is used in NixOS to implement kernel-specific behaviour. For instance, if the kernel has the `iwlwifi` feature (i.e. has built-in support for Intel wireless chipsets), then NixOS doesn’t have to build the external `iwlwifi` package:
+
+```nix
+modulesTree = [kernel]
+ ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi
+ ++ ...;
+```
+
+How to add a new (major) version of the Linux kernel to Nixpkgs:
+
+1. Copy the old Nix expression (e.g. `linux-2.6.21.nix`) to the new one (e.g. `linux-2.6.22.nix`) and update it.
+
+2. Add the new kernel to `all-packages.nix` (e.g., create an attribute `kernel_2_6_22`).
+
+3. Now we’re going to update the kernel configuration. First unpack the kernel. Then for each supported platform (`i686`, `x86_64`, `uml`) do the following:
+
+ 1. Make an copy from the old config (e.g. `config-2.6.21-i686-smp`) to the new one (e.g. `config-2.6.22-i686-smp`).
+
+ 2. Copy the config file for this platform (e.g. `config-2.6.22-i686-smp`) to `.config` in the kernel source tree.
+
+ 3. Run `make oldconfig ARCH={i386,x86_64,um}` and answer all questions. (For the uml configuration, also add `SHELL=bash`.) Make sure to keep the configuration consistent between platforms (i.e. don’t enable some feature on `i686` and disable it on `x86_64`).
+
+ 4. If needed you can also run `make menuconfig`:
+
+ ```ShellSession
+ $ nix-env -i ncurses
+ $ export NIX_CFLAGS_LINK=-lncurses
+ $ make menuconfig ARCH=arch
+ ```
+
+ 5. Copy `.config` over the new config file (e.g. `config-2.6.22-i686-smp`).
+
+4. Test building the kernel: `nix-build -A kernel_2_6_22`. If it compiles, ship it! For extra credit, try booting NixOS with it.
+
+5. It may be that the new kernel requires updating the external kernel modules and kernel-dependent packages listed in the `linuxPackagesFor` function in `all-packages.nix` (such as the NVIDIA drivers, AUFS, etc.). If the updated packages aren’t backwards compatible with older kernels, you may need to keep the older versions around.
diff --git a/doc/builders/packages/linux.xml b/doc/builders/packages/linux.xml
deleted file mode 100644
index 72d0e21493b3..000000000000
--- a/doc/builders/packages/linux.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-linux-kernel">
- <title>Linux kernel</title>
-
- <para>
- The Nix expressions to build the Linux kernel are in <link
-xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel"><filename>pkgs/os-specific/linux/kernel</filename></link>.
- </para>
-
- <para>
- The function that builds the kernel has an argument <varname>kernelPatches</varname> which should be a list of <literal>{name, patch, extraConfig}</literal> attribute sets, where <varname>name</varname> is the name of the patch (which is included in the kernel’s <varname>meta.description</varname> attribute), <varname>patch</varname> is the patch itself (possibly compressed), and <varname>extraConfig</varname> (optional) is a string specifying extra options to be concatenated to the kernel configuration file (<filename>.config</filename>).
- </para>
-
- <para>
- The kernel derivation exports an attribute <varname>features</varname> specifying whether optional functionality is or isn’t enabled. This is used in NixOS to implement kernel-specific behaviour. For instance, if the kernel has the <varname>iwlwifi</varname> feature (i.e. has built-in support for Intel wireless chipsets), then NixOS doesn’t have to build the external <varname>iwlwifi</varname> package:
-<programlisting>
-modulesTree = [kernel]
- ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi
- ++ ...;
-</programlisting>
- </para>
-
- <para>
- How to add a new (major) version of the Linux kernel to Nixpkgs:
- <orderedlist>
- <listitem>
- <para>
- Copy the old Nix expression (e.g. <filename>linux-2.6.21.nix</filename>) to the new one (e.g. <filename>linux-2.6.22.nix</filename>) and update it.
- </para>
- </listitem>
- <listitem>
- <para>
- Add the new kernel to <filename>all-packages.nix</filename> (e.g., create an attribute <varname>kernel_2_6_22</varname>).
- </para>
- </listitem>
- <listitem>
- <para>
- Now we’re going to update the kernel configuration. First unpack the kernel. Then for each supported platform (<literal>i686</literal>, <literal>x86_64</literal>, <literal>uml</literal>) do the following:
- <orderedlist>
- <listitem>
- <para>
- Make an copy from the old config (e.g. <filename>config-2.6.21-i686-smp</filename>) to the new one (e.g. <filename>config-2.6.22-i686-smp</filename>).
- </para>
- </listitem>
- <listitem>
- <para>
- Copy the config file for this platform (e.g. <filename>config-2.6.22-i686-smp</filename>) to <filename>.config</filename> in the kernel source tree.
- </para>
- </listitem>
- <listitem>
- <para>
- Run <literal>make oldconfig ARCH=<replaceable>{i386,x86_64,um}</replaceable></literal> and answer all questions. (For the uml configuration, also add <literal>SHELL=bash</literal>.) Make sure to keep the configuration consistent between platforms (i.e. don’t enable some feature on <literal>i686</literal> and disable it on <literal>x86_64</literal>).
- </para>
- </listitem>
- <listitem>
- <para>
- If needed you can also run <literal>make menuconfig</literal>:
-<screen>
-<prompt>$ </prompt>nix-env -i ncurses
-<prompt>$ </prompt>export NIX_CFLAGS_LINK=-lncurses
-<prompt>$ </prompt>make menuconfig ARCH=<replaceable>arch</replaceable></screen>
- </para>
- </listitem>
- <listitem>
- <para>
- Copy <filename>.config</filename> over the new config file (e.g. <filename>config-2.6.22-i686-smp</filename>).
- </para>
- </listitem>
- </orderedlist>
- </para>
- </listitem>
- <listitem>
- <para>
- Test building the kernel: <literal>nix-build -A kernel_2_6_22</literal>. If it compiles, ship it! For extra credit, try booting NixOS with it.
- </para>
- </listitem>
- <listitem>
- <para>
- It may be that the new kernel requires updating the external kernel modules and kernel-dependent packages listed in the <varname>linuxPackagesFor</varname> function in <filename>all-packages.nix</filename> (such as the NVIDIA drivers, AUFS, etc.). If the updated packages aren’t backwards compatible with older kernels, you may need to keep the older versions around.
- </para>
- </listitem>
- </orderedlist>
- </para>
-</section>
diff --git a/doc/builders/packages/nginx.section.md b/doc/builders/packages/nginx.section.md
new file mode 100644
index 000000000000..154c21f9b369
--- /dev/null
+++ b/doc/builders/packages/nginx.section.md
@@ -0,0 +1,11 @@
+# Nginx {#sec-nginx}
+
+[Nginx](https://nginx.org) is a reverse proxy and lightweight webserver.
+
+## ETags on static files served from the Nix store {#sec-nginx-etag}
+
+HTTP has a couple different mechanisms for caching to prevent clients from having to download the same content repeatedly if a resource has not changed since the last time it was requested. When nginx is used as a server for static files, it implements the caching mechanism based on the [`Last-Modified`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified) response header automatically; unfortunately, it works by using filesystem timestamps to determine the value of the `Last-Modified` header. This doesn't give the desired behavior when the file is in the Nix store, because all file timestamps are set to 0 (for reasons related to build reproducibility).
+
+Fortunately, HTTP supports an alternative (and more effective) caching mechanism: the [`ETag`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) response header. The value of the `ETag` header specifies some identifier for the particular content that the server is sending (e.g. a hash). When a client makes a second request for the same resource, it sends that value back in an `If-None-Match` header. If the ETag value is unchanged, then the server does not need to resend the content.
+
+As of NixOS 19.09, the nginx package in Nixpkgs is patched such that when nginx serves a file out of `/nix/store`, the hash in the store path is used as the `ETag` header in the HTTP response, thus providing proper caching functionality. This happens automatically; you do not need to do modify any configuration to get this behavior.
diff --git a/doc/builders/packages/nginx.xml b/doc/builders/packages/nginx.xml
deleted file mode 100644
index 65854ba02366..000000000000
--- a/doc/builders/packages/nginx.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-nginx">
- <title>Nginx</title>
-
- <para>
- <link xlink:href="https://nginx.org/">Nginx</link> is a reverse proxy and lightweight webserver.
- </para>
-
- <section xml:id="sec-nginx-etag">
- <title>ETags on static files served from the Nix store</title>
-
- <para>
- HTTP has a couple different mechanisms for caching to prevent clients from having to download the same content repeatedly if a resource has not changed since the last time it was requested. When nginx is used as a server for static files, it implements the caching mechanism based on the <link xlink:href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified"><literal>Last-Modified</literal></link> response header automatically; unfortunately, it works by using filesystem timestamps to determine the value of the <literal>Last-Modified</literal> header. This doesn't give the desired behavior when the file is in the Nix store, because all file timestamps are set to 0 (for reasons related to build reproducibility).
- </para>
-
- <para>
- Fortunately, HTTP supports an alternative (and more effective) caching mechanism: the <link xlink:href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag"><literal>ETag</literal></link> response header. The value of the <literal>ETag</literal> header specifies some identifier for the particular content that the server is sending (e.g. a hash). When a client makes a second request for the same resource, it sends that value back in an <literal>If-None-Match</literal> header. If the ETag value is unchanged, then the server does not need to resend the content.
- </para>
-
- <para>
- As of NixOS 19.09, the nginx package in Nixpkgs is patched such that when nginx serves a file out of <filename>/nix/store</filename>, the hash in the store path is used as the <literal>ETag</literal> header in the HTTP response, thus providing proper caching functionality. This happens automatically; you do not need to do modify any configuration to get this behavior.
- </para>
- </section>
-</section>
diff --git a/doc/builders/packages/opengl.section.md b/doc/builders/packages/opengl.section.md
new file mode 100644
index 000000000000..6866bf89221a
--- /dev/null
+++ b/doc/builders/packages/opengl.section.md
@@ -0,0 +1,15 @@
+# OpenGL {#sec-opengl}
+
+OpenGL support varies depending on which hardware is used and which drivers are available and loaded.
+
+Broadly, we support both GL vendors: Mesa and NVIDIA.
+
+## NixOS Desktop
+
+The NixOS desktop or other non-headless configurations are the primary target for OpenGL libraries and applications. The current solution for discovering which drivers are available is based on [libglvnd](https://gitlab.freedesktop.org/glvnd/libglvnd). `libglvnd` performs "vendor-neutral dispatch", trying a variety of techniques to find the system's GL implementation. In practice, this will be either via standard GLX for X11 users or EGL for Wayland users, and supporting either NVIDIA or Mesa extensions.
+
+## Nix on GNU/Linux
+
+If you are using a non-NixOS GNU/Linux/X11 desktop with free software video drivers, consider launching OpenGL-dependent programs from Nixpkgs with Nixpkgs versions of `libglvnd` and `mesa.drivers` in `LD_LIBRARY_PATH`. For Mesa drivers, the Linux kernel version doesn't have to match nixpkgs.
+
+For proprietary video drivers you might have luck with also adding the corresponding video driver package.
diff --git a/doc/builders/packages/opengl.xml b/doc/builders/packages/opengl.xml
deleted file mode 100644
index dfd64b188586..000000000000
--- a/doc/builders/packages/opengl.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-opengl">
- <title>OpenGL</title>
-
- <para>
- Packages that use OpenGL have NixOS desktop as their primary target. The current solution for loading the GPU-specific drivers is based on <literal>libglvnd</literal> and looks for the driver implementation in <literal>LD_LIBRARY_PATH</literal>. If you are using a non-NixOS GNU/Linux/X11 desktop with free software video drivers, consider launching OpenGL-dependent programs from Nixpkgs with Nixpkgs versions of <literal>libglvnd</literal> and <literal>mesa.drivers</literal> in <literal>LD_LIBRARY_PATH</literal>. For proprietary video drivers you might have luck with also adding the corresponding video driver package.
- </para>
-</section>
diff --git a/doc/builders/packages/shell-helpers.section.md b/doc/builders/packages/shell-helpers.section.md
new file mode 100644
index 000000000000..57b8619c5007
--- /dev/null
+++ b/doc/builders/packages/shell-helpers.section.md
@@ -0,0 +1,12 @@
+# Interactive shell helpers {#sec-shell-helpers}
+
+Some packages provide the shell integration to be more useful. But unlike other systems, nix doesn't have a standard `share` directory location. This is why a bunch `PACKAGE-share` scripts are shipped that print the location of the corresponding shared folder. Current list of such packages is as following:
+
+- `fzf` : `fzf-share`
+
+E.g. `fzf` can then used in the `.bashrc` like this:
+
+```bash
+source "$(fzf-share)/completion.bash"
+source "$(fzf-share)/key-bindings.bash"
+```
diff --git a/doc/builders/packages/shell-helpers.xml b/doc/builders/packages/shell-helpers.xml
deleted file mode 100644
index cb70d527d67b..000000000000
--- a/doc/builders/packages/shell-helpers.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-shell-helpers">
- <title>Interactive shell helpers</title>
-
- <para>
- Some packages provide the shell integration to be more useful. But unlike other systems, nix doesn't have a standard share directory location. This is why a bunch <command>PACKAGE-share</command> scripts are shipped that print the location of the corresponding shared folder. Current list of such packages is as following:
- <itemizedlist>
- <listitem>
- <para>
- <literal>autojump</literal>: <command>autojump-share</command>
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>fzf</literal>: <command>fzf-share</command>
- </para>
- </listitem>
- </itemizedlist>
- E.g. <literal>autojump</literal> can then used in the .bashrc like this:
-<screen>
- source "$(autojump-share)/autojump.bash"
-</screen>
- </para>
-</section>
diff --git a/doc/builders/packages/urxvt.section.md b/doc/builders/packages/urxvt.section.md
new file mode 100644
index 000000000000..2d1196d92278
--- /dev/null
+++ b/doc/builders/packages/urxvt.section.md
@@ -0,0 +1,71 @@
+# Urxvt {#sec-urxvt}
+
+Urxvt, also known as rxvt-unicode, is a highly customizable terminal emulator.
+
+## Configuring urxvt {#sec-urxvt-conf}
+
+In `nixpkgs`, urxvt is provided by the package `rxvt-unicode`. It can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, use an overlay or directly install an expression that overrides its configuration, such as
+
+```nix
+rxvt-unicode.override {
+ configure = { availablePlugins, ... }: {
+ plugins = with availablePlugins; [ perls resize-font vtwheel ];
+ };
+}
+```
+
+If the `configure` function returns an attrset without the `plugins` attribute, `availablePlugins` will be used automatically.
+
+In order to add plugins but also keep all default plugins installed, it is possible to use the following method:
+
+```nix
+rxvt-unicode.override {
+ configure = { availablePlugins, ... }: {
+ plugins = (builtins.attrValues availablePlugins) ++ [ custom-plugin ];
+ };
+}
+```
+
+To get a list of all the plugins available, open the Nix REPL and run
+
+```ShellSession
+$ nix repl
+:l <nixpkgs>
+map (p: p.name) pkgs.rxvt-unicode.plugins
+```
+
+Alternatively, if your shell is bash or zsh and have completion enabled, simply type `nixpkgs.rxvt-unicode.plugins.<tab>`.
+
+In addition to `plugins` the options `extraDeps` and `perlDeps` can be used to install extra packages. `extraDeps` can be used, for example, to provide `xsel` (a clipboard manager) to the clipboard plugin, without installing it globally:
+
+```nix
+rxvt-unicode.override {
+ configure = { availablePlugins, ... }: {
+ pluginsDeps = [ xsel ];
+ };
+}
+```
+
+`perlDeps` is a handy way to provide Perl packages to your custom plugins (in `$HOME/.urxvt/ext`). For example, if you need `AnyEvent` you can do:
+
+```nix
+rxvt-unicode.override {
+ configure = { availablePlugins, ... }: {
+ perlDeps = with perlPackages; [ AnyEvent ];
+ };
+}
+```
+
+## Packaging urxvt plugins {#sec-urxvt-pkg}
+
+Urxvt plugins resides in `pkgs/applications/misc/rxvt-unicode-plugins`. To add a new plugin create an expression in a subdirectory and add the package to the set in `pkgs/applications/misc/rxvt-unicode-plugins/default.nix`.
+
+A plugin can be any kind of derivation, the only requirement is that it should always install perl scripts in `$out/lib/urxvt/perl`. Look for existing plugins for examples.
+
+If the plugin is itself a perl package that needs to be imported from other plugins or scripts, add the following passthrough:
+
+```nix
+passthru.perlPackages = [ "self" ];
+```
+
+This will make the urxvt wrapper pick up the dependency and set up the perl path accordingly.
diff --git a/doc/builders/packages/urxvt.xml b/doc/builders/packages/urxvt.xml
deleted file mode 100644
index 330e056b6560..000000000000
--- a/doc/builders/packages/urxvt.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-urxvt">
- <title>Urxvt</title>
-
- <para>
- Urxvt, also known as rxvt-unicode, is a highly customizable terminal emulator.
- </para>
-
- <section xml:id="sec-urxvt-conf">
-
- <title>Configuring urxvt</title>
-
- <para>
- In <literal>nixpkgs</literal>, urxvt is provided by the package
- <literal>rxvt-unicode</literal>. It can be configured to include your choice
- of plugins, reducing its closure size from the default configuration which
- includes all available plugins. To make use of this functionality, use an
- overlay or directly install an expression that overrides its configuration,
- such as
-<programlisting>
-rxvt-unicode.override {
- configure = { availablePlugins, ... }: {
- plugins = with availablePlugins; [ perls resize-font vtwheel ];
- };
-}
-</programlisting>
- If the <literal>configure</literal> function returns an attrset without the
- <literal>plugins</literal> attribute, <literal>availablePlugins</literal>
- will be used automatically.
- </para>
-
- <para>
- In order to add plugins but also keep all default plugins installed, it is
- possible to use the following method:
-<programlisting>
-rxvt-unicode.override {
- configure = { availablePlugins, ... }: {
- plugins = (builtins.attrValues availablePlugins) ++ [ custom-plugin ];
- };
-}
-</programlisting>
- </para>
-
- <para>
- To get a list of all the plugins available, open the Nix REPL and run
-<screen>
-<prompt>$ </prompt>nix repl
-:l &lt;nixpkgs&gt;
-map (p: p.name) pkgs.rxvt-unicode.plugins
-</screen>
- Alternatively, if your shell is bash or zsh and have completion enabled,
- simply type <literal>nixpkgs.rxvt-unicode.plugins.&lt;tab&gt;</literal>.
- </para>
-
- <para>
- In addition to <literal>plugins</literal> the options
- <literal>extraDeps</literal> and <literal>perlDeps</literal> can be used
- to install extra packages.
- <literal>extraDeps</literal> can be used, for example, to provide
- <literal>xsel</literal> (a clipboard manager) to the clipboard plugin,
- without installing it globally:
-<programlisting>
-rxvt-unicode.override {
- configure = { availablePlugins, ... }: {
- pluginsDeps = [ xsel ];
- };
-}
-</programlisting>
-
- <literal>perlDeps</literal> is a handy way to provide Perl packages to
- your custom plugins (in <literal>$HOME/.urxvt/ext</literal>). For example,
- if you need <literal>AnyEvent</literal> you can do:
-<programlisting>
-rxvt-unicode.override {
- configure = { availablePlugins, ... }: {
- perlDeps = with perlPackages; [ AnyEvent ];
- };
-}
-</programlisting>
- </para>
-
- </section>
-
- <section xml:id="sec-urxvt-pkg">
-
- <title>Packaging urxvt plugins</title>
-
- <para>
- Urxvt plugins resides in
- <literal>pkgs/applications/misc/rxvt-unicode-plugins</literal>.
- To add a new plugin create an expression in a subdirectory and add the
- package to the set in
- <literal>pkgs/applications/misc/rxvt-unicode-plugins/default.nix</literal>.
- </para>
-
- <para>
- A plugin can be any kind of derivation, the only requirement is that it
- should always install perl scripts in <literal>$out/lib/urxvt/perl</literal>.
- Look for existing plugins for examples.
- </para>
-
- <para>
- If the plugin is itself a perl package that needs to be imported from
- other plugins or scripts, add the following passthrough:
-<programlisting>
-passthru.perlPackages = [ "self" ];
-</programlisting>
- This will make the urxvt wrapper pick up the dependency and set up the perl
- path accordingly.
- </para>
-
- </section>
-
-</section>
diff --git a/doc/builders/packages/weechat.section.md b/doc/builders/packages/weechat.section.md
new file mode 100644
index 000000000000..1d99b00e6323
--- /dev/null
+++ b/doc/builders/packages/weechat.section.md
@@ -0,0 +1,85 @@
+# Weechat {#sec-weechat}
+
+Weechat can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, install an expression that overrides its configuration such as
+
+```nix
+weechat.override {configure = {availablePlugins, ...}: {
+ plugins = with availablePlugins; [ python perl ];
+ }
+}
+```
+
+If the `configure` function returns an attrset without the `plugins` attribute, `availablePlugins` will be used automatically.
+
+The plugins currently available are `python`, `perl`, `ruby`, `guile`, `tcl` and `lua`.
+
+The python and perl plugins allows the addition of extra libraries. For instance, the `inotify.py` script in `weechat-scripts` requires D-Bus or libnotify, and the `fish.py` script requires `pycrypto`. To use these scripts, use the plugin's `withPackages` attribute:
+
+```nix
+weechat.override { configure = {availablePlugins, ...}: {
+ plugins = with availablePlugins; [
+ (python.withPackages (ps: with ps; [ pycrypto python-dbus ]))
+ ];
+ };
+}
+```
+
+In order to also keep all default plugins installed, it is possible to use the following method:
+
+```nix
+weechat.override { configure = { availablePlugins, ... }: {
+ plugins = builtins.attrValues (availablePlugins // {
+ python = availablePlugins.python.withPackages (ps: with ps; [ pycrypto python-dbus ]);
+ });
+}; }
+```
+
+WeeChat allows to set defaults on startup using the `--run-command`. The `configure` method can be used to pass commands to the program:
+
+```nix
+weechat.override {
+ configure = { availablePlugins, ... }: {
+ init = ''
+ /set foo bar
+ /server add freenode chat.freenode.org
+ '';
+ };
+}
+```
+
+Further values can be added to the list of commands when running `weechat --run-command "your-commands"`.
+
+Additionally it's possible to specify scripts to be loaded when starting `weechat`. These will be loaded before the commands from `init`:
+
+```nix
+weechat.override {
+ configure = { availablePlugins, ... }: {
+ scripts = with pkgs.weechatScripts; [
+ weechat-xmpp weechat-matrix-bridge wee-slack
+ ];
+ init = ''
+ /set plugins.var.python.jabber.key "val"
+ '':
+ };
+}
+```
+
+In `nixpkgs` there's a subpackage which contains derivations for WeeChat scripts. Such derivations expect a `passthru.scripts` attribute which contains a list of all scripts inside the store path. Furthermore all scripts have to live in `$out/share`. An exemplary derivation looks like this:
+
+```nix
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+ name = "exemplary-weechat-script";
+ src = fetchurl {
+ url = "https://scripts.tld/your-scripts.tar.gz";
+ sha256 = "...";
+ };
+ passthru.scripts = [ "foo.py" "bar.lua" ];
+ installPhase = ''
+ mkdir $out/share
+ cp foo.py $out/share
+ cp bar.lua $out/share
+ '';
+}
+```
diff --git a/doc/builders/packages/weechat.xml b/doc/builders/packages/weechat.xml
deleted file mode 100644
index a110d3f491c7..000000000000
--- a/doc/builders/packages/weechat.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-weechat">
- <title>Weechat</title>
-
- <para>
- Weechat can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, install an expression that overrides its configuration such as
-<programlisting>weechat.override {configure = {availablePlugins, ...}: {
- plugins = with availablePlugins; [ python perl ];
- }
-}</programlisting>
- If the <literal>configure</literal> function returns an attrset without the <literal>plugins</literal> attribute, <literal>availablePlugins</literal> will be used automatically.
- </para>
-
- <para>
- The plugins currently available are <literal>python</literal>, <literal>perl</literal>, <literal>ruby</literal>, <literal>guile</literal>, <literal>tcl</literal> and <literal>lua</literal>.
- </para>
-
- <para>
- The python and perl plugins allows the addition of extra libraries. For instance, the <literal>inotify.py</literal> script in weechat-scripts requires D-Bus or libnotify, and the <literal>fish.py</literal> script requires pycrypto. To use these scripts, use the plugin's <literal>withPackages</literal> attribute:
-<programlisting>weechat.override { configure = {availablePlugins, ...}: {
- plugins = with availablePlugins; [
- (python.withPackages (ps: with ps; [ pycrypto python-dbus ]))
- ];
- };
-}
-</programlisting>
- </para>
-
- <para>
- In order to also keep all default plugins installed, it is possible to use the following method:
-<programlisting>weechat.override { configure = { availablePlugins, ... }: {
- plugins = builtins.attrValues (availablePlugins // {
- python = availablePlugins.python.withPackages (ps: with ps; [ pycrypto python-dbus ]);
- });
-}; }
-</programlisting>
- </para>
-
- <para>
- WeeChat allows to set defaults on startup using the <literal>--run-command</literal>. The <literal>configure</literal> method can be used to pass commands to the program:
-<programlisting>weechat.override {
- configure = { availablePlugins, ... }: {
- init = ''
- /set foo bar
- /server add freenode chat.freenode.org
- '';
- };
-}</programlisting>
- Further values can be added to the list of commands when running <literal>weechat --run-command "your-commands"</literal>.
- </para>
-
- <para>
- Additionally it's possible to specify scripts to be loaded when starting <literal>weechat</literal>. These will be loaded before the commands from <literal>init</literal>:
-<programlisting>weechat.override {
- configure = { availablePlugins, ... }: {
- scripts = with pkgs.weechatScripts; [
- weechat-xmpp weechat-matrix-bridge wee-slack
- ];
- init = ''
- /set plugins.var.python.jabber.key "val"
- '':
- };
-}</programlisting>
- </para>
-
- <para>
- In <literal>nixpkgs</literal> there's a subpackage which contains derivations for WeeChat scripts. Such derivations expect a <literal>passthru.scripts</literal> attribute which contains a list of all scripts inside the store path. Furthermore all scripts have to live in <literal>$out/share</literal>. An exemplary derivation looks like this:
-<programlisting>{ stdenv, fetchurl }:
-
-stdenv.mkDerivation {
- name = "exemplary-weechat-script";
- src = fetchurl {
- url = "https://scripts.tld/your-scripts.tar.gz";
- sha256 = "...";
- };
- passthru.scripts = [ "foo.py" "bar.lua" ];
- installPhase = ''
- mkdir $out/share
- cp foo.py $out/share
- cp bar.lua $out/share
- '';
-}</programlisting>
- </para>
-</section>
diff --git a/doc/builders/packages/xorg.section.md b/doc/builders/packages/xorg.section.md
new file mode 100644
index 000000000000..be220a25404a
--- /dev/null
+++ b/doc/builders/packages/xorg.section.md
@@ -0,0 +1,34 @@
+# X.org {#sec-xorg}
+
+The Nix expressions for the X.org packages reside in `pkgs/servers/x11/xorg/default.nix`. This file is automatically generated from lists of tarballs in an X.org release. As such it should not be modified directly; rather, you should modify the lists, the generator script or the file `pkgs/servers/x11/xorg/overrides.nix`, in which you can override or add to the derivations produced by the generator.
+
+## Katamari Tarballs
+
+X.org upstream releases used to include [katamari](https://en.wiktionary.org/wiki/%E3%81%8B%E3%81%9F%E3%81%BE%E3%82%8A) releases, which included a holistic recommended version for each tarball, up until 7.7. To create a list of tarballs in a katamari release:
+
+```ShellSession
+export release="X11R7.7"
+export url="mirror://xorg/$release/src/everything/"
+cat $(PRINT_PATH=1 nix-prefetch-url $url | tail -n 1) \
+ | perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'url'}$2\n"; }; }' \
+ | sort > "tarballs-$release.list"
+```
+
+## Individual Tarballs
+
+The upstream release process for [X11R7.8](https://x.org/wiki/Releases/7.8/) does not include a planned katamari. Instead, each component of X.org is released as its own tarball. We maintain `pkgs/servers/x11/xorg/tarballs.list` as a list of tarballs for each individual package. This list includes X.org core libraries and protocol descriptions, extra newer X11 interface libraries, like `xorg.libxcb`, and classic utilities which are largely unused but still available if needed, like `xorg.imake`.
+
+## Generating Nix Expressions
+
+The generator is invoked as follows:
+
+```ShellSession
+cd pkgs/servers/x11/xorg
+<tarballs.list perl ./generate-expr-from-tarballs.pl
+```
+
+For each of the tarballs in the `.list` files, the script downloads it, unpacks it, and searches its `configure.ac` and `*.pc.in` files for dependencies. This information is used to generate `default.nix`. The generator caches downloaded tarballs between runs. Pay close attention to the `NOT FOUND: $NAME` messages at the end of the run, since they may indicate missing dependencies. (Some might be optional dependencies, however.)
+
+## Overriding the Generator
+
+If the expression for a package requires derivation attributes that the generator cannot figure out automatically (say, `patches` or a `postInstall` hook), you should modify `pkgs/servers/x11/xorg/overrides.nix`.
diff --git a/doc/builders/packages/xorg.xml b/doc/builders/packages/xorg.xml
deleted file mode 100644
index ebf4930cc097..000000000000
--- a/doc/builders/packages/xorg.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-xorg">
- <title>X.org</title>
-
- <para>
- The Nix expressions for the X.org packages reside in <filename>pkgs/servers/x11/xorg/default.nix</filename>. This file is automatically generated from lists of tarballs in an X.org release. As such it should not be modified directly; rather, you should modify the lists, the generator script or the file <filename>pkgs/servers/x11/xorg/overrides.nix</filename>, in which you can override or add to the derivations produced by the generator.
- </para>
-
- <para>
- The generator is invoked as follows:
-<screen>
-<prompt>$ </prompt>cd pkgs/servers/x11/xorg
-<prompt>$ </prompt>cat tarballs-7.5.list extra.list old.list \
- | perl ./generate-expr-from-tarballs.pl
-</screen>
- For each of the tarballs in the <filename>.list</filename> files, the script downloads it, unpacks it, and searches its <filename>configure.ac</filename> and <filename>*.pc.in</filename> files for dependencies. This information is used to generate <filename>default.nix</filename>. The generator caches downloaded tarballs between runs. Pay close attention to the <literal>NOT FOUND: <replaceable>name</replaceable></literal> messages at the end of the run, since they may indicate missing dependencies. (Some might be optional dependencies, however.)
- </para>
-
- <para>
- A file like <filename>tarballs-7.5.list</filename> contains all tarballs in a X.org release. It can be generated like this:
-<screen>
-<prompt>$ </prompt>export i="mirror://xorg/X11R7.4/src/everything/"
-<prompt>$ </prompt>cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \
- | perl -e 'while (&lt;>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'i'}$2\n"; }; }' \
- | sort > tarballs-7.4.list
-</screen>
- <filename>extra.list</filename> contains libraries that aren’t part of X.org proper, but are closely related to it, such as <literal>libxcb</literal>. <filename>old.list</filename> contains some packages that were removed from X.org, but are still needed by some people or by other packages (such as <varname>imake</varname>).
- </para>
-
- <para>
- If the expression for a package requires derivation attributes that the generator cannot figure out automatically (say, <varname>patches</varname> or a <varname>postInstall</varname> hook), you should modify <filename>pkgs/servers/x11/xorg/overrides.nix</filename>.
- </para>
-</section>
diff --git a/doc/contributing/reviewing-contributions.xml b/doc/contributing/reviewing-contributions.xml
index fe79d8d992b1..991db77bc584 100644
--- a/doc/contributing/reviewing-contributions.xml
+++ b/doc/contributing/reviewing-contributions.xml
@@ -7,8 +7,8 @@
<warning>
<para>
The following section is a draft, and the policy for reviewing is still being discussed in issues such as <link
- xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166 </link> and <link
- xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836 </link>.
+ xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166 </link> and <link
+ xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836 </link>.
</para>
</warning>
<para>
@@ -49,18 +49,6 @@
<itemizedlist>
<listitem>
<para>
- Add labels to the pull request. (Requires commit rights)
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>8.has: package (update)</literal> and any topic label that fit the updated package.
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>
Ensure that the package versioning fits the guidelines.
</para>
</listitem>
@@ -188,18 +176,6 @@
<itemizedlist>
<listitem>
<para>
- Add labels to the pull request. (Requires commit rights)
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>8.has: package (new)</literal> and any topic label that fit the new package.
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>
Ensure that the package versioning is fitting the guidelines.
</para>
</listitem>
@@ -304,18 +280,6 @@
<itemizedlist>
<listitem>
<para>
- Add labels to the pull request. (Requires commit rights)
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>8.has: module (update)</literal> and any topic label that fit the module.
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>
Ensure that the module maintainers are notified.
</para>
<itemizedlist>
@@ -408,18 +372,6 @@
<itemizedlist>
<listitem>
<para>
- Add labels to the pull request. (Requires commit rights)
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>8.has: module (new)</literal> and any topic label that fit the module.
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- <listitem>
- <para>
Ensure that the module tests, if any, are succeeding.
</para>
</listitem>
@@ -515,12 +467,8 @@
It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
</para>
- <para>
- TODO: add the procedure to request merging rights.
- </para>
-
<!--
-The following paragraph about how to deal with unactive contributors is just a
+The following paragraphs about how to deal with unactive contributors is just a
proposition and should be modified to what the community agrees to be the right
policy.
@@ -529,6 +477,10 @@ policy.
-->
<para>
+ Please see the discussion in <link xlink:href="https://github.com/NixOS/nixpkgs/issues/50105">GitHub nixpkgs issue #50105</link> for information on how to proceed to be granted this level of access.
+ </para>
+
+ <para>
In a case a contributor definitively leaves the Nix community, they should create an issue or post on <link
xlink:href="https://discourse.nixos.org">Discourse</link> with references of packages and modules they maintain so the maintainership can be taken over by other contributors.
</para>
diff --git a/doc/languages-frameworks/beam.section.md b/doc/languages-frameworks/beam.section.md
new file mode 100644
index 000000000000..ad3b94880b5c
--- /dev/null
+++ b/doc/languages-frameworks/beam.section.md
@@ -0,0 +1,84 @@
+# BEAM Languages (Erlang, Elixir & LFE) {#sec-beam}
+
+## Introduction {#beam-introduction}
+
+In this document and related Nix expressions, we use the term, *BEAM*, to describe the environment. BEAM is the name of the Erlang Virtual Machine and, as far as we're concerned, from a packaging perspective, all languages that run on the BEAM are interchangeable. That which varies, like the build system, is transparent to users of any given BEAM package, so we make no distinction.
+
+## Structure {#beam-structure}
+
+All BEAM-related expressions are available via the top-level `beam` attribute, which includes:
+
+ - `interpreters`: a set of compilers running on the BEAM, including multiple Erlang/OTP versions (`beam.interpreters.erlangR19`, etc), Elixir (`beam.interpreters.elixir`) and LFE (`beam.interpreters.lfe`).
+
+ - `packages`: a set of package builders (Mix and rebar3), each compiled with a specific Erlang/OTP version, e.g. `beam.packages.erlangR19`.
+
+The default Erlang compiler, defined by `beam.interpreters.erlang`, is aliased as `erlang`. The default BEAM package set is defined by `beam.packages.erlang` and aliased at the top level as `beamPackages`.
+
+To create a package builder built with a custom Erlang version, use the lambda, `beam.packagesWith`, which accepts an Erlang/OTP derivation and produces a package builder similar to `beam.packages.erlang`.
+
+Many Erlang/OTP distributions available in `beam.interpreters` have versions with ODBC and/or Java enabled or without wx (no observer support). For example, there's `beam.interpreters.erlangR22_odbc_javac`, which corresponds to `beam.interpreters.erlangR22` and `beam.interpreters.erlangR22_nox`, which corresponds to `beam.interpreters.erlangR22`.
+
+## Build Tools {#build-tools}
+
+### Rebar3 {#build-tools-rebar3}
+
+We provide a version of Rebar3, under `rebar3`. We also provide a helper to fetch Rebar3 dependencies from a lockfile under `fetchRebar3Deps`.
+
+### Mix & Erlang.mk {#build-tools-other}
+
+Both Mix and Erlang.mk work exactly as expected. There is a bootstrap process that needs to be run for both, however, which is supported by the `buildMix` and `buildErlangMk` derivations, respectively.
+
+## How to Install BEAM Packages {#how-to-install-beam-packages}
+
+BEAM builders are not registered at the top level, simply because they are not relevant to the vast majority of Nix users. To install any of those builders into your profile, refer to them by their attribute path `beamPackages.rebar3`:
+
+```ShellSession
+$ nix-env -f "<nixpkgs>" -iA beamPackages.rebar3
+```
+
+## Packaging BEAM Applications {#packaging-beam-applications}
+
+### Erlang Applications {#packaging-erlang-applications}
+
+#### Rebar3 Packages {#rebar3-packages}
+
+The Nix function, `buildRebar3`, defined in `beam.packages.erlang.buildRebar3` and aliased at the top level, can be used to build a derivation that understands how to build a Rebar3 project.
+
+If a package needs to compile native code via Rebar3's port compilation mechanism, add `compilePort = true;` to the derivation.
+
+#### Erlang.mk Packages {#erlang-mk-packages}
+
+Erlang.mk functions similarly to Rebar3, except we use `buildErlangMk` instead of `buildRebar3`.
+
+#### Mix Packages {#mix-packages}
+
+Mix functions similarly to Rebar3, except we use `buildMix` instead of `buildRebar3`.
+
+Alternatively, we can use `buildHex` as a shortcut:
+
+## How to Develop {#how-to-develop}
+
+### Creating a Shell {#creating-a-shell}
+
+Usually, we need to create a `shell.nix` file and do our development inside of the environment specified therein. Just install your version of erlang and other interpreter, and then user your normal build tools. As an example with elixir:
+
+```nix
+{ pkgs ? import "<nixpkgs"> {} }:
+
+with pkgs;
+
+let
+
+ elixir = beam.packages.erlangR22.elixir_1_9;
+
+in
+mkShell {
+ buildInputs = [ elixir ];
+
+ ERL_INCLUDE_PATH="${erlang}/lib/erlang/usr/include";
+}
+```
+
+#### Building in a Shell (for Mix Projects) {#building-in-a-shell}
+
+Using a `shell.nix` as described (see <xref linkend="creating-a-shell"/>) should just work.
diff --git a/doc/languages-frameworks/beam.xml b/doc/languages-frameworks/beam.xml
deleted file mode 100644
index addab24f7f6d..000000000000
--- a/doc/languages-frameworks/beam.xml
+++ /dev/null
@@ -1,159 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-beam">
- <title>BEAM Languages (Erlang, Elixir &amp; LFE)</title>
-
- <section xml:id="beam-introduction">
- <title>Introduction</title>
-
- <para>
- In this document and related Nix expressions, we use the term, <emphasis>BEAM</emphasis>, to describe the environment. BEAM is the name of the Erlang Virtual Machine and, as far as we're concerned, from a packaging perspective, all languages that run on the BEAM are interchangeable. That which varies, like the build system, is transparent to users of any given BEAM package, so we make no distinction.
- </para>
- </section>
-
- <section xml:id="beam-structure">
- <title>Structure</title>
-
- <para>
- All BEAM-related expressions are available via the top-level <literal>beam</literal> attribute, which includes:
- </para>
-
- <itemizedlist>
- <listitem>
- <para>
- <literal>interpreters</literal>: a set of compilers running on the BEAM, including multiple Erlang/OTP versions (<literal>beam.interpreters.erlangR19</literal>, etc), Elixir (<literal>beam.interpreters.elixir</literal>) and LFE (<literal>beam.interpreters.lfe</literal>).
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>packages</literal>: a set of package builders (Mix and rebar3), each compiled with a specific Erlang/OTP version, e.g. <literal>beam.packages.erlangR19</literal>.
- </para>
- </listitem>
- </itemizedlist>
-
- <para>
- The default Erlang compiler, defined by <literal>beam.interpreters.erlang</literal>, is aliased as <literal>erlang</literal>. The default BEAM package set is defined by <literal>beam.packages.erlang</literal> and aliased at the top level as <literal>beamPackages</literal>.
- </para>
-
- <para>
- To create a package builder built with a custom Erlang version, use the lambda, <literal>beam.packagesWith</literal>, which accepts an Erlang/OTP derivation and produces a package builder similar to <literal>beam.packages.erlang</literal>.
- </para>
-
- <para>
- Many Erlang/OTP distributions available in <literal>beam.interpreters</literal> have versions with ODBC and/or Java enabled or without wx (no observer support). For example, there's <literal>beam.interpreters.erlangR22_odbc_javac</literal>, which corresponds to <literal>beam.interpreters.erlangR22</literal> and <literal>beam.interpreters.erlangR22_nox</literal>, which corresponds to <literal>beam.interpreters.erlangR22</literal>.
- </para>
- </section>
-
- <section xml:id="build-tools">
- <title>Build Tools</title>
-
- <section xml:id="build-tools-rebar3">
- <title>Rebar3</title>
-
- <para>
- We provide a version of Rebar3, under <literal>rebar3</literal>. We also provide a helper to fetch Rebar3 dependencies from a lockfile under <literal>fetchRebar3Deps</literal>.
- </para>
- </section>
-
- <section xml:id="build-tools-other">
- <title>Mix &amp; Erlang.mk</title>
-
- <para>
- Both Mix and Erlang.mk work exactly as expected. There is a bootstrap process that needs to be run for both, however, which is supported by the <literal>buildMix</literal> and <literal>buildErlangMk</literal> derivations, respectively.
- </para>
- </section>
- </section>
-
- <section xml:id="how-to-install-beam-packages">
- <title>How to Install BEAM Packages</title>
-
- <para>
- BEAM builders are not registered at the top level, simply because they are not relevant to the vast majority of Nix users.
- To install any of those builders into your profile, refer to them by their attribute path <literal>beamPackages.rebar3</literal>:
- </para>
-
-<screen>
-<prompt>$ </prompt>nix-env -f &quot;&lt;nixpkgs&gt;&quot; -iA beamPackages.rebar3
-</screen>
-</section>
-
- <section xml:id="packaging-beam-applications">
- <title>Packaging BEAM Applications</title>
-
- <section xml:id="packaging-erlang-applications">
- <title>Erlang Applications</title>
-
- <section xml:id="rebar3-packages">
- <title>Rebar3 Packages</title>
-
- <para>
- The Nix function, <literal>buildRebar3</literal>, defined in <literal>beam.packages.erlang.buildRebar3</literal> and aliased at the top level, can be used to build a derivation that understands how to build a Rebar3 project.
- </para>
-
- <para>
- If a package needs to compile native code via Rebar3's port compilation mechanism, add <literal>compilePort = true;</literal> to the derivation.
- </para>
- </section>
-
- <section xml:id="erlang-mk-packages">
- <title>Erlang.mk Packages</title>
-
- <para>
- Erlang.mk functions similarly to Rebar3, except we use <literal>buildErlangMk</literal> instead of <literal>buildRebar3</literal>.
- </para>
-
- </section>
-
- <section xml:id="mix-packages">
- <title>Mix Packages</title>
-
- <para>
- Mix functions similarly to Rebar3, except we use <literal>buildMix</literal> instead of <literal>buildRebar3</literal>.
- </para>
-
- <para>
- Alternatively, we can use <literal>buildHex</literal> as a shortcut:
- </para>
- </section>
- </section>
- </section>
-
- <section xml:id="how-to-develop">
- <title>How to Develop</title>
-
- <section xml:id="creating-a-shell">
- <title>Creating a Shell</title>
-
- <para>
- Usually, we need to create a <literal>shell.nix</literal> file and do our development inside of the environment specified therein. Just install your version of erlang and other interpreter, and then user your normal build tools.
- As an example with elixir:
- </para>
-
-<programlisting>
-{ pkgs ? import &quot;&lt;nixpkgs&quot;&gt; {} }:
-
-with pkgs;
-
-let
-
- elixir = beam.packages.erlangR22.elixir_1_9;
-
-in
-mkShell {
- buildInputs = [ elixir ];
-
- ERL_INCLUDE_PATH="${erlang}/lib/erlang/usr/include";
-}
-</programlisting>
-
- <section xml:id="building-in-a-shell">
- <title>Building in a Shell (for Mix Projects)</title>
-
- <para>
- Using a <literal>shell.nix</literal> as described (see <xref
- linkend="creating-a-shell"/>) should just work.
- </para>
- </section>
- </section>
- </section>
-</section>
diff --git a/doc/languages-frameworks/coq.section.md b/doc/languages-frameworks/coq.section.md
new file mode 100644
index 000000000000..714e84efc8db
--- /dev/null
+++ b/doc/languages-frameworks/coq.section.md
@@ -0,0 +1,40 @@
+# Coq {#sec-language-coq}
+
+Coq libraries should be installed in `$(out)/lib/coq/${coq.coq-version}/user-contrib/`. Such directories are automatically added to the `$COQPATH` environment variable by the hook defined in the Coq derivation.
+
+Some extensions (plugins) might require OCaml and sometimes other OCaml packages. The `coq.ocamlPackages` attribute can be used to depend on the same package set Coq was built against.
+
+Coq libraries may be compatible with some specific versions of Coq only. The `compatibleCoqVersions` attribute is used to precisely select those versions of Coq that are compatible with this derivation.
+
+Here is a simple package example. It is a pure Coq library, thus it depends on Coq. It builds on the Mathematical Components library, thus it also takes `mathcomp` as `buildInputs`. Its `Makefile` has been generated using `coq_makefile` so we only have to set the `$COQLIB` variable at install time.
+
+```nix
+{ stdenv, fetchFromGitHub, coq, mathcomp }:
+
+stdenv.mkDerivation rec {
+ name = "coq${coq.coq-version}-multinomials-${version}";
+ version = "1.0";
+ src = fetchFromGitHub {
+ owner = "math-comp";
+ repo = "multinomials";
+ rev = version;
+ sha256 = "1qmbxp1h81cy3imh627pznmng0kvv37k4hrwi2faa101s6bcx55m";
+ };
+
+ buildInputs = [ coq ];
+ propagatedBuildInputs = [ mathcomp ];
+
+ installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/";
+
+ meta = {
+ description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials";
+ inherit (src.meta) homepage;
+ license = stdenv.lib.licenses.cecill-b;
+ inherit (coq.meta) platforms;
+ };
+
+ passthru = {
+ compatibleCoqVersions = v: builtins.elem v [ "8.5" "8.6" "8.7" ];
+ };
+}
+```
diff --git a/doc/languages-frameworks/coq.xml b/doc/languages-frameworks/coq.xml
deleted file mode 100644
index 86d9226166f5..000000000000
--- a/doc/languages-frameworks/coq.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-language-coq">
- <title>Coq</title>
-
- <para>
- Coq libraries should be installed in <literal>$(out)/lib/coq/${coq.coq-version}/user-contrib/</literal>. Such directories are automatically added to the <literal>$COQPATH</literal> environment variable by the hook defined in the Coq derivation.
- </para>
-
- <para>
- Some extensions (plugins) might require OCaml and sometimes other OCaml packages. The <literal>coq.ocamlPackages</literal> attribute can be used to depend on the same package set Coq was built against.
- </para>
-
- <para>
- Coq libraries may be compatible with some specific versions of Coq only. The <literal>compatibleCoqVersions</literal> attribute is used to precisely select those versions of Coq that are compatible with this derivation.
- </para>
-
- <para>
- Here is a simple package example. It is a pure Coq library, thus it depends on Coq. It builds on the Mathematical Components library, thus it also takes <literal>mathcomp</literal> as <literal>buildInputs</literal>. Its <literal>Makefile</literal> has been generated using <literal>coq_makefile</literal> so we only have to set the <literal>$COQLIB</literal> variable at install time.
- </para>
-
-<programlisting>
-{ stdenv, fetchFromGitHub, coq, mathcomp }:
-
-stdenv.mkDerivation rec {
- name = "coq${coq.coq-version}-multinomials-${version}";
- version = "1.0";
- src = fetchFromGitHub {
- owner = "math-comp";
- repo = "multinomials";
- rev = version;
- sha256 = "1qmbxp1h81cy3imh627pznmng0kvv37k4hrwi2faa101s6bcx55m";
- };
-
- buildInputs = [ coq ];
- propagatedBuildInputs = [ mathcomp ];
-
- installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/";
-
- meta = {
- description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials";
- inherit (src.meta) homepage;
- license = stdenv.lib.licenses.cecill-b;
- inherit (coq.meta) platforms;
- };
-
- passthru = {
- compatibleCoqVersions = v: builtins.elem v [ "8.5" "8.6" "8.7" ];
- };
-}
-</programlisting>
-</section>
diff --git a/doc/languages-frameworks/dotnet.section.md b/doc/languages-frameworks/dotnet.section.md
index c56f4728bed8..88fd74db8256 100644
--- a/doc/languages-frameworks/dotnet.section.md
+++ b/doc/languages-frameworks/dotnet.section.md
@@ -64,9 +64,9 @@ $ dotnet --info
The `dotnetCorePackages.sdk_X_Y` is preferred over the old dotnet-sdk as both major and minor version are very important for a dotnet environment. If a given minor version isn't present (or was changed), then this will likely break your ability to build a project.
-## dotnetCorePackages.sdk vs dotnetCorePackages.netcore vs dotnetCorePackages.aspnetcore
+## dotnetCorePackages.sdk vs vs dotnetCorePackages.net vs dotnetCorePackages.netcore vs dotnetCorePackages.aspnetcore
-The `dotnetCorePackages.sdk` contains both a runtime and the full sdk of a given version. The `netcore` and `aspnetcore` packages are meant to serve as minimal runtimes to deploy alongside already built applications.
+The `dotnetCorePackages.sdk` contains both a runtime and the full sdk of a given version. The `net`, `netcore` and `aspnetcore` packages are meant to serve as minimal runtimes to deploy alongside already built applications. For runtime versions >= .NET 5 `net` is used while `netcore` is used for older .NET Core runtime version.
## Packaging a Dotnet Application
diff --git a/doc/languages-frameworks/gnome.xml b/doc/languages-frameworks/gnome.xml
index 159216ca981f..f555cacbd2c4 100644
--- a/doc/languages-frameworks/gnome.xml
+++ b/doc/languages-frameworks/gnome.xml
@@ -28,6 +28,22 @@
</para>
</section>
+ <section xml:id="ssec-gnome-gdk-pixbuf-loaders">
+ <title>GdkPixbuf loaders</title>
+
+ <para>
+ GTK applications typically use <link xlink:href="https://developer.gnome.org/gdk-pixbuf/stable/">GdkPixbuf</link> to load images. But <package>gdk-pixbuf</package> package only supports basic bitmap formats like JPEG, PNG or TIFF, requiring to use third-party loader modules for other formats. This is especially painful since GTK itself includes SVG icons, which cannot be rendered without a loader provided by <package>librsvg</package>.
+ </para>
+
+ <para>
+ Unlike other libraries mentioned in this section, GdkPixbuf only supports a single value in its controlling environment variable <envar>GDK_PIXBUF_MODULE_FILE</envar>. It is supposed to point to a cache file containing information about the available loaders. Each loader package will contain a <filename>lib/gdk-pixbuf-2.0/2.10.0/loaders.cache</filename> file describing the default loaders in <package>gdk-pixbuf</package> package plus the loader contained in the package itself. If you want to use multiple third-party loaders, you will need to create your own cache file manually. Fortunately, this is pretty rare as <link xlink:href="https://gitlab.gnome.org/federico/gdk-pixbuf-survey/blob/master/src/modules.md">not many loaders exist</link>.
+ </para>
+
+ <para>
+ <package>gdk-pixbuf</package> contains <link linkend="ssec-gnome-hooks-gdk-pixbuf">a setup hook</link> that sets <envar>GDK_PIXBUF_MODULE_FILE</envar> from dependencies but as mentioned in further section, it is pretty limited. Loaders should propagate this setup hook.
+ </para>
+ </section>
+
<section xml:id="ssec-gnome-icons">
<title>Icons</title>
@@ -100,9 +116,16 @@ preFixup = ''
done
'';
</programlisting>
- Fortunately, there is <package>wrapGAppsHook</package>, that does the wrapping for us. In particular, it works in conjunction with other setup hooks that will populate the variable:
+ </para>
+ <para>
+ Fortunately, there is <package xml:id="ssec-gnome-hooks-wrapgappshook">wrapGAppsHook</package>. It works in conjunction with other setup hooks that populate environment variables, and it will then wrap all executables in <filename>bin</filename> and <filename>libexec</filename> directories using said variables.
+ </para>
+ <para>
+ For convenience, it also adds <package>dconf.lib</package> for a GIO module implementing a GSettings backend using <package>dconf</package>, <package>gtk3</package> for GSettings schemas, and <package>librsvg</package> for GdkPixbuf loader to the closure. In case you are packaging a program without a graphical interface, you might want to use <package xml:id="ssec-gnome-hooks-wrapgappsnoguihook">wrapGAppsNoGuiHook</package>, which runs the same script as <package>wrapGAppsHook</package> but does not bring <package>gtk3</package> and <package>librsvg</package> into the closure.
+ </para>
+ <para>
<itemizedlist>
- <listitem xml:id="ssec-gnome-hooks-wrapgappshook">
+ <listitem>
<para>
<package>wrapGAppsHook</package> itself will add the package’s <filename>share</filename> directory to <envar>XDG_DATA_DIRS</envar>.
</para>
@@ -112,6 +135,11 @@ preFixup = ''
<package>glib</package> setup hook will populate <envar>GSETTINGS_SCHEMAS_PATH</envar> and then <package>wrapGAppsHook</package> will prepend it to <envar>XDG_DATA_DIRS</envar>.
</para>
</listitem>
+ <listitem xml:id="ssec-gnome-hooks-gdk-pixbuf">
+ <para>
+ <package>gdk-pixbuf</package> setup hook will populate <envar>GDK_PIXBUF_MODULE_FILE</envar> with the path to biggest <filename>loaders.cache</filename> file from the dependencies containing <link xlink:href="ssec-gnome-gdk-pixbuf-loaders">GdkPixbuf loaders</link>. This works fine when there are only two packages containing loaders (<package>gdk-pixbuf</package> and e.g. <package>librsvg</package>) – it will choose the second one, reasonably expecting that it will be bigger since it describes extra loader in addition to the default ones. But when there are more than two loader packages, this logic will break. One possible solution would be constructing a custom cache file for each package containing a program like <filename>services/x11/gdk-pixbuf.nix</filename> NixOS module does. <package>wrapGAppsHook</package> copies the <envar>GDK_PIXBUF_MODULE_FILE</envar> environment variable into the produced wrapper.
+ </para>
+ </listitem>
<listitem xml:id="ssec-gnome-hooks-gtk-drop-icon-theme-cache">
<para>
One of <package>gtk3</package>’s setup hooks will remove <filename>icon-theme.cache</filename> files from package’s icon theme directories to avoid conflicts. Icon theme packages should prevent this with <code>dontDropIconThemeCache = true;</code>.
@@ -178,7 +206,7 @@ preFixup = ''
</term>
<listitem>
<para>
- There are no schemas avalable in <envar>XDG_DATA_DIRS</envar>. Temporarily add a random package containing schemas like <package>gsettings-desktop-schemas</package> to <literal>buildInputs</literal>. <link linkend="ssec-gnome-hooks-glib"><package>glib</package></link> and <link linkend="ssec-gnome-hooks-wrapgappshook"><package>wrapGAppsHook</package></link> setup hooks will take care of making the schemas available to application and you will see the actual missing schemas with the <link linkend="ssec-gnome-common-issues-missing-schema">next error</link>. Or you can try looking through the source code for the actual schemas used.
+ There are no schemas available in <envar>XDG_DATA_DIRS</envar>. Temporarily add a random package containing schemas like <package>gsettings-desktop-schemas</package> to <literal>buildInputs</literal>. <link linkend="ssec-gnome-hooks-glib"><package>glib</package></link> and <link linkend="ssec-gnome-hooks-wrapgappshook"><package>wrapGAppsHook</package></link> setup hooks will take care of making the schemas available to application and you will see the actual missing schemas with the <link linkend="ssec-gnome-common-issues-missing-schema">next error</link>. Or you can try looking through the source code for the actual schemas used.
</para>
</listitem>
</varlistentry>
diff --git a/doc/languages-frameworks/go.section.md b/doc/languages-frameworks/go.section.md
new file mode 100644
index 000000000000..b4228d9d313d
--- /dev/null
+++ b/doc/languages-frameworks/go.section.md
@@ -0,0 +1,140 @@
+# Go {#sec-language-go}
+
+## Go modules {#ssec-language-go}
+
+The function `buildGoModule` builds Go programs managed with Go modules. It builds a [Go Modules](https://github.com/golang/go/wiki/Modules) through a two phase build:
+
+- An intermediate fetcher derivation. This derivation will be used to fetch all of the dependencies of the Go module.
+- A final derivation will use the output of the intermediate derivation to build the binaries and produce the final output.
+
+### Example for `buildGoModule` {#ex-buildGoModule}
+
+In the following is an example expression using `buildGoModule`, the following arguments are of special significance to the function:
+
+- `vendorSha256`: is the hash of the output of the intermediate fetcher derivation. `vendorSha256` can also take `null` as an input. When `null` is used as a value, rather than fetching the dependencies and vendoring them, we use the vendoring included within the source repo. If you'd like to not have to update this field on dependency changes, run `go mod vendor` in your source repo and set `vendorSha256 = null;`
+- `runVend`: runs the vend command to generate the vendor directory. This is useful if your code depends on c code and go mod tidy does not include the needed sources to build.
+
+```nix
+pet = buildGoModule rec {
+ pname = "pet";
+ version = "0.3.4";
+
+ src = fetchFromGitHub {
+ owner = "knqyf263";
+ repo = "pet";
+ rev = "v${version}";
+ sha256 = "0m2fzpqxk7hrbxsgqplkg7h2p7gv6s1miymv3gvw0cz039skag0s";
+ };
+
+ vendorSha256 = "1879j77k96684wi554rkjxydrj8g3hpp0kvxz03sd8dmwr3lh83j";
+
+ runVend = true;
+
+ meta = with lib; {
+ description = "Simple command-line snippet manager, written in Go";
+ homepage = "https://github.com/knqyf263/pet";
+ license = licenses.mit;
+ maintainers = with maintainers; [ kalbasit ];
+ platforms = platforms.linux ++ platforms.darwin;
+ };
+}
+```
+
+## `buildGoPackage` (legacy) {#ssec-go-legacy}
+
+The function `buildGoPackage` builds legacy Go programs, not supporting Go modules.
+
+### Example for `buildGoPackage`
+
+In the following is an example expression using buildGoPackage, the following arguments are of special significance to the function:
+
+- `goPackagePath` specifies the package's canonical Go import path.
+- `goDeps` is where the Go dependencies of a Go program are listed as a list of package source identified by Go import path. It could be imported as a separate `deps.nix` file for readability. The dependency data structure is described below.
+
+```nix
+deis = buildGoPackage rec {
+ pname = "deis";
+ version = "1.13.0";
+
+ goPackagePath = "github.com/deis/deis";
+
+ src = fetchFromGitHub {
+ owner = "deis";
+ repo = "deis";
+ rev = "v${version}";
+ sha256 = "1qv9lxqx7m18029lj8cw3k7jngvxs4iciwrypdy0gd2nnghc68sw";
+ };
+
+ goDeps = ./deps.nix;
+}
+```
+
+The `goDeps` attribute can be imported from a separate `nix` file that defines which Go libraries are needed and should be included in `GOPATH` for `buildPhase`:
+
+```nix
+# deps.nix
+[ # goDeps is a list of Go dependencies.
+ {
+ # goPackagePath specifies Go package import path.
+ goPackagePath = "gopkg.in/yaml.v2";
+ fetch = {
+ # `fetch type` that needs to be used to get package source.
+ # If `git` is used there should be `url`, `rev` and `sha256` defined next to it.
+ type = "git";
+ url = "https://gopkg.in/yaml.v2";
+ rev = "a83829b6f1293c91addabc89d0571c246397bbf4";
+ sha256 = "1m4dsmk90sbi17571h6pld44zxz7jc4lrnl4f27dpd1l8g5xvjhh";
+ };
+ }
+ {
+ goPackagePath = "github.com/docopt/docopt-go";
+ fetch = {
+ type = "git";
+ url = "https://github.com/docopt/docopt-go";
+ rev = "784ddc588536785e7299f7272f39101f7faccc3f";
+ sha256 = "0wwz48jl9fvl1iknvn9dqr4gfy1qs03gxaikrxxp9gry6773v3sj";
+ };
+ }
+]
+```
+
+To extract dependency information from a Go package in automated way use [go2nix](https://github.com/kamilchm/go2nix). It can produce complete derivation and `goDeps` file for Go programs.
+
+You may use Go packages installed into the active Nix profiles by adding the following to your ~/.bashrc:
+
+```bash
+for p in $NIX_PROFILES; do
+ GOPATH="$p/share/go:$GOPATH"
+done
+```
+
+## Attributes used by the builders {#ssec-go-common-attributes}
+
+Both `buildGoModule` and `buildGoPackage` can be tweaked to behave slightly differently, if the following attributes are used:
+
+### `buildFlagsArray` and `buildFlags`: {#ex-goBuildFlags-noarray}
+
+These attributes set build flags supported by `go build`. We recommend using `buildFlagsArray`. The most common use case of these attributes is to make the resulting executable aware of its own version. For example:
+
+```nix
+ buildFlagsArray = [
+ # Note: single quotes are not needed.
+ "-ldflags=-X main.Version=${version} -X main.Commit=${version}"
+ ];
+```
+
+```nix
+ buildFlagsArray = ''
+ -ldflags=
+ -X main.Version=${version}
+ -X main.Commit=${version}
+ '';
+```
+
+### `deleteVendor` {#var-go-deleteVendor}
+
+Removes the pre-existing vendor directory. This should only be used if the dependencies included in the vendor folder are broken or incomplete.
+
+### `subPackages` {#var-go-subPackages}
+
+Limits the builder from building child packages that have not been listed. If <varname>subPackages</varname> is not specified, all child packages will be built.
diff --git a/doc/languages-frameworks/go.xml b/doc/languages-frameworks/go.xml
deleted file mode 100644
index ebdcf616054c..000000000000
--- a/doc/languages-frameworks/go.xml
+++ /dev/null
@@ -1,248 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-language-go">
- <title>Go</title>
-
- <section xml:id="ssec-go-modules">
- <title>Go modules</title>
-
- <para>
- The function <varname> buildGoModule </varname> builds Go programs managed with Go modules. It builds a <link xlink:href="https://github.com/golang/go/wiki/Modules">Go modules</link> through a two phase build:
- <itemizedlist>
- <listitem>
- <para>
- An intermediate fetcher derivation. This derivation will be used to fetch all of the dependencies of the Go module.
- </para>
- </listitem>
- <listitem>
- <para>
- A final derivation will use the output of the intermediate derivation to build the binaries and produce the final output.
- </para>
- </listitem>
- </itemizedlist>
- </para>
-
- <example xml:id='ex-buildGoModule'>
- <title>buildGoModule</title>
-<programlisting>
-pet = buildGoModule rec {
- pname = "pet";
- version = "0.3.4";
-
- src = fetchFromGitHub {
- owner = "knqyf263";
- repo = "pet";
- rev = "v${version}";
- sha256 = "0m2fzpqxk7hrbxsgqplkg7h2p7gv6s1miymv3gvw0cz039skag0s";
- };
-
- vendorSha256 = "1879j77k96684wi554rkjxydrj8g3hpp0kvxz03sd8dmwr3lh83j"; <co xml:id='ex-buildGoModule-1' />
-
- runVend = true; <co xml:id='ex-buildGoModule-2' />
-
- meta = with lib; {
- description = "Simple command-line snippet manager, written in Go";
- homepage = "https://github.com/knqyf263/pet";
- license = licenses.mit;
- maintainers = with maintainers; [ kalbasit ];
- platforms = platforms.linux ++ platforms.darwin;
- };
-}
-</programlisting>
- </example>
-
- <para>
- <xref linkend='ex-buildGoModule'/> is an example expression using buildGoModule, the following arguments are of special significance to the function:
- <calloutlist>
- <callout arearefs='ex-buildGoModule-1'>
- <para>
- <varname>vendorSha256</varname> is the hash of the output of the intermediate fetcher derivation.
- </para>
- </callout>
- <callout arearefs='ex-buildGoModule-2'>
- <para>
- <varname>runVend</varname> runs the vend command to generate the vendor directory. This is useful if your code depends on c code and go mod tidy does not include the needed sources to build.
- </para>
- </callout>
- </calloutlist>
- </para>
-
- <para>
- <varname>vendorSha256</varname> can also take <varname>null</varname> as an input. When `null` is used as a value, rather than fetching the dependencies and vendoring them, we use the vendoring included within the source repo. If you'd like to not have to update this field on dependency changes, run `go mod vendor` in your source repo and set 'vendorSha256 = null;'
- </para>
- </section>
-
- <section xml:id="ssec-go-legacy">
- <title>Go legacy</title>
-
- <para>
- The function <varname> buildGoPackage </varname> builds legacy Go programs, not supporting Go modules.
- </para>
-
- <example xml:id='ex-buildGoPackage'>
- <title>buildGoPackage</title>
-<programlisting>
-deis = buildGoPackage rec {
- pname = "deis";
- version = "1.13.0";
-
- goPackagePath = "github.com/deis/deis"; <co xml:id='ex-buildGoPackage-1' />
-
- src = fetchFromGitHub {
- owner = "deis";
- repo = "deis";
- rev = "v${version}";
- sha256 = "1qv9lxqx7m18029lj8cw3k7jngvxs4iciwrypdy0gd2nnghc68sw";
- };
-
- goDeps = ./deps.nix; <co xml:id='ex-buildGoPackage-2' />
-}
-</programlisting>
- </example>
-
- <para>
- <xref linkend='ex-buildGoPackage'/> is an example expression using buildGoPackage, the following arguments are of special significance to the function:
- <calloutlist>
- <callout arearefs='ex-buildGoPackage-1'>
- <para>
- <varname>goPackagePath</varname> specifies the package's canonical Go import path.
- </para>
- </callout>
- <callout arearefs='ex-buildGoPackage-2'>
- <para>
- <varname>goDeps</varname> is where the Go dependencies of a Go program are listed as a list of package source identified by Go import path. It could be imported as a separate <varname>deps.nix</varname> file for readability. The dependency data structure is described below.
- </para>
- </callout>
- </calloutlist>
- </para>
-
- <para>
- The <varname>goDeps</varname> attribute can be imported from a separate <varname>nix</varname> file that defines which Go libraries are needed and should be included in <varname>GOPATH</varname> for <varname>buildPhase</varname>.
- </para>
-
- <example xml:id='ex-goDeps'>
- <title>deps.nix</title>
-<programlisting>
-[ <co xml:id='ex-goDeps-1' />
- {
- goPackagePath = "gopkg.in/yaml.v2"; <co xml:id='ex-goDeps-2' />
- fetch = {
- type = "git"; <co xml:id='ex-goDeps-3' />
- url = "https://gopkg.in/yaml.v2";
- rev = "a83829b6f1293c91addabc89d0571c246397bbf4";
- sha256 = "1m4dsmk90sbi17571h6pld44zxz7jc4lrnl4f27dpd1l8g5xvjhh";
- };
- }
- {
- goPackagePath = "github.com/docopt/docopt-go";
- fetch = {
- type = "git";
- url = "https://github.com/docopt/docopt-go";
- rev = "784ddc588536785e7299f7272f39101f7faccc3f";
- sha256 = "0wwz48jl9fvl1iknvn9dqr4gfy1qs03gxaikrxxp9gry6773v3sj";
- };
- }
-]
-</programlisting>
- </example>
-
- <para>
- <calloutlist>
- <callout arearefs='ex-goDeps-1'>
- <para>
- <varname>goDeps</varname> is a list of Go dependencies.
- </para>
- </callout>
- <callout arearefs='ex-goDeps-2'>
- <para>
- <varname>goPackagePath</varname> specifies Go package import path.
- </para>
- </callout>
- <callout arearefs='ex-goDeps-3'>
- <para>
- <varname>fetch type</varname> that needs to be used to get package source. If <varname>git</varname> is used there should be <varname>url</varname>, <varname>rev</varname> and <varname>sha256</varname> defined next to it.
- </para>
- </callout>
- </calloutlist>
- </para>
-
- <para>
- To extract dependency information from a Go package in automated way use <link xlink:href="https://github.com/kamilchm/go2nix">go2nix</link>. It can produce complete derivation and <varname>goDeps</varname> file for Go programs.
- </para>
-
- <para>
- You may use Go packages installed into the active Nix profiles by adding the following to your ~/.bashrc:
-<screen>
-for p in $NIX_PROFILES; do
- GOPATH="$p/share/go:$GOPATH"
-done
-</screen>
- </para>
- </section>
-
- <section xml:id="ssec-go-common-attributes">
- <title>Attributes used by the builders</title>
-
- <para>
- Both <link xlink:href="#ssec-go-modules"><varname>buildGoModule</varname></link> and <link xlink:href="#ssec-go-modules"><varname>buildGoPackage</varname></link> can be tweaked to behave slightly differently, if the following attributes are used:
- </para>
-
- <variablelist>
- <varlistentry xml:id="var-go-buildFlagsArray">
- <term>
- <varname>buildFlagsArray</varname> and <varname>buildFlags</varname>
- </term>
- <listitem>
- <para>
- These attributes set build flags supported by <varname>go build</varname>. We recommend using <varname>buildFlagsArray</varname>. The most common use case of these attributes is to make the resulting executable aware of its own version. For example:
- </para>
- <example xml:id='ex-goBuildFlags-nospaces'>
- <title>buildFlagsArray</title>
-<programlisting>
- buildFlagsArray = [
- "-ldflags=-X main.Version=${version} -X main.Commit=${version}" <co xml:id='ex-goBuildFlags-1' />
- ];
-</programlisting>
- </example>
- <calloutlist>
- <callout arearefs='ex-goBuildFlags-1'>
- <para>
- Note: single quotes are not needed.
- </para>
- </callout>
- </calloutlist>
- <example xml:id='ex-goBuildFlags-noarray'>
- <title>buildFlagsArray</title>
-<programlisting>
- buildFlagsArray = ''
- -ldflags=
- -X main.Version=${version}
- -X main.Commit=${version}
- '';
-</programlisting>
- </example>
- </listitem>
- </varlistentry>
- <varlistentry xml:id="var-go-deleteVendor">
- <term>
- <varname>deleteVendor</varname>
- </term>
- <listitem>
- <para>
- Removes the pre-existing vendor directory. This should only be used if the dependencies included in the vendor folder are broken or incomplete.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry xml:id="var-go-subPackages">
- <term>
- <varname>subPackages</varname>
- </term>
- <listitem>
- <para>
- Limits the builder from building child packages that have not been listed. If <varname>subPackages</varname> is not specified, all child packages will be built.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
-</section>
diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml
index 3366108cd938..daa57cf1f865 100644
--- a/doc/languages-frameworks/index.xml
+++ b/doc/languages-frameworks/index.xml
@@ -7,29 +7,29 @@
</para>
<xi:include href="agda.section.xml" />
<xi:include href="android.section.xml" />
- <xi:include href="beam.xml" />
+ <xi:include href="beam.section.xml" />
<xi:include href="bower.xml" />
- <xi:include href="coq.xml" />
+ <xi:include href="coq.section.xml" />
<xi:include href="crystal.section.xml" />
<xi:include href="emscripten.section.xml" />
<xi:include href="gnome.xml" />
- <xi:include href="go.xml" />
+ <xi:include href="go.section.xml" />
<xi:include href="haskell.section.xml" />
<xi:include href="idris.section.xml" />
<xi:include href="ios.section.xml" />
- <xi:include href="java.xml" />
+ <xi:include href="java.section.xml" />
<xi:include href="lua.section.xml" />
<xi:include href="maven.section.xml" />
<xi:include href="node.section.xml" />
- <xi:include href="ocaml.xml" />
+ <xi:include href="ocaml.section.xml" />
<xi:include href="perl.xml" />
<xi:include href="php.section.xml" />
<xi:include href="python.section.xml" />
- <xi:include href="qt.xml" />
+ <xi:include href="qt.section.xml" />
<xi:include href="r.section.xml" />
- <xi:include href="ruby.xml" />
+ <xi:include href="ruby.section.xml" />
<xi:include href="rust.section.xml" />
- <xi:include href="texlive.xml" />
+ <xi:include href="texlive.section.xml" />
<xi:include href="titanium.section.xml" />
<xi:include href="vim.section.xml" />
</chapter>
diff --git a/doc/languages-frameworks/java.section.md b/doc/languages-frameworks/java.section.md
new file mode 100644
index 000000000000..77919d43f748
--- /dev/null
+++ b/doc/languages-frameworks/java.section.md
@@ -0,0 +1,91 @@
+# Java {#sec-language-java}
+
+Ant-based Java packages are typically built from source as follows:
+
+```nix
+stdenv.mkDerivation {
+ name = "...";
+ src = fetchurl { ... };
+
+ nativeBuildInputs = [ jdk ant ];
+
+ buildPhase = "ant";
+}
+```
+
+Note that `jdk` is an alias for the OpenJDK (self-built where available,
+or pre-built via Zulu). Platforms with OpenJDK not (yet) in Nixpkgs
+(`Aarch32`, `Aarch64`) point to the (unfree) `oraclejdk`.
+
+JAR files that are intended to be used by other packages should be
+installed in `$out/share/java`. JDKs have a stdenv setup hook that add
+any JARs in the `share/java` directories of the build inputs to the
+`CLASSPATH` environment variable. For instance, if the package `libfoo`
+installs a JAR named `foo.jar` in its `share/java` directory, and
+another package declares the attribute
+
+```nix
+buildInputs = [ libfoo ];
+nativeBuildInputs = [ jdk ];
+```
+
+then `CLASSPATH` will be set to
+`/nix/store/...-libfoo/share/java/foo.jar`.
+
+Private JARs should be installed in a location like
+`$out/share/package-name`.
+
+If your Java package provides a program, you need to generate a wrapper
+script to run it using a JRE. You can use `makeWrapper` for this:
+
+```nix
+nativeBuildInputs = [ makeWrapper ];
+
+installPhase = ''
+ mkdir -p $out/bin
+ makeWrapper ${jre}/bin/java $out/bin/foo \
+ --add-flags "-cp $out/share/java/foo.jar org.foo.Main"
+'';
+```
+
+Since the introduction of the Java Platform Module System in Java 9,
+Java distributions typically no longer ship with a general-purpose JRE:
+instead, they allow generating a JRE with only the modules required for
+your application(s). Because we can't predict what modules will be
+needed on a general-purpose system, the default jre package is the full
+JDK. When building a minimal system/image, you can override the
+`modules` parameter on `jre_minimal` to build a JRE with only the
+modules relevant for you:
+
+```nix
+let
+ my_jre = pkgs.jre_minimal.override {
+ modules = [
+ # The modules used by 'something' and 'other' combined:
+ "java.base"
+ "java.logging"
+ ];
+ };
+ something = (pkgs.something.override { jre = my_jre; });
+ other = (pkgs.other.override { jre = my_jre; });
+in
+ ...
+```
+
+Note all JDKs passthru `home`, so if your application requires
+environment variables like `JAVA_HOME` being set, that can be done in a
+generic fashion with the `--set` argument of `makeWrapper`:
+
+```bash
+--set JAVA_HOME ${jdk.home}
+```
+
+It is possible to use a different Java compiler than `javac` from the
+OpenJDK. For instance, to use the GNU Java Compiler:
+
+```nix
+nativeBuildInputs = [ gcj ant ];
+```
+
+Here, Ant will automatically use `gij` (the GNU Java Runtime) instead of
+the OpenJRE.
diff --git a/doc/languages-frameworks/java.xml b/doc/languages-frameworks/java.xml
deleted file mode 100644
index 881d492b5bff..000000000000
--- a/doc/languages-frameworks/java.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-language-java">
- <title>Java</title>
-
- <para>
- Ant-based Java packages are typically built from source as follows:
-<programlisting>
-stdenv.mkDerivation {
- name = "...";
- src = fetchurl { ... };
-
- nativeBuildInputs = [ jdk ant ];
-
- buildPhase = "ant";
-}
-</programlisting>
- Note that <varname>jdk</varname> is an alias for the OpenJDK (self-built where available, or pre-built via Zulu). Platforms with OpenJDK not (yet) in Nixpkgs (<literal>Aarch32</literal>, <literal>Aarch64</literal>) point to the (unfree) <literal>oraclejdk</literal>.
- </para>
-
- <para>
- JAR files that are intended to be used by other packages should be installed in <filename>$out/share/java</filename>. JDKs have a stdenv setup hook that add any JARs in the <filename>share/java</filename> directories of the build inputs to the <envar>CLASSPATH</envar> environment variable. For instance, if the package <literal>libfoo</literal> installs a JAR named <filename>foo.jar</filename> in its <filename>share/java</filename> directory, and another package declares the attribute
-<programlisting>
-buildInputs = [ libfoo ];
-nativeBuildInputs = [ jdk ];
-</programlisting>
- then <envar>CLASSPATH</envar> will be set to <filename>/nix/store/...-libfoo/share/java/foo.jar</filename>.
- </para>
-
- <para>
- Private JARs should be installed in a location like <filename>$out/share/<replaceable>package-name</replaceable></filename>.
- </para>
-
- <para>
- If your Java package provides a program, you need to generate a wrapper script to run it using a JRE. You can use <literal>makeWrapper</literal> for this:
-<programlisting>
-nativeBuildInputs = [ makeWrapper ];
-
-installPhase =
- ''
- mkdir -p $out/bin
- makeWrapper ${jre}/bin/java $out/bin/foo \
- --add-flags "-cp $out/share/java/foo.jar org.foo.Main"
- '';
-</programlisting>
-Since the introduction of the Java Platform Module System in Java 9, Java distributions typically no longer ship with a general-purpose JRE: instead, they allow generating a JRE with only the modules required for your application(s). Because we can't predict what modules will be needed on a general-purpose system, the default <package>jre</package> package is the full JDK. When building a minimal system/image, you can override the <literal>modules</literal> parameter on <literal>jre_minimal</literal> to build a JRE with only the modules relevant for you:
-<programlisting>
-let
- my_jre = pkgs.jre_minimal.override {
- modules = [
- # The modules used by 'something' and 'other' combined:
- "java.base"
- "java.logging"
- ];
- };
- something = (pkgs.something.override { jre = my_jre; });
- other = (pkgs.other.override { jre = my_jre; });
-in
- ...
-</programlisting>
- </para>
-
- <para>
- Note all JDKs passthru <literal>home</literal>, so if your application requires environment variables like <envar>JAVA_HOME</envar> being set, that can be done in a generic fashion with the <literal>--set</literal> argument of <literal>makeWrapper</literal>:
-<programlisting>
---set JAVA_HOME ${jdk.home}
-</programlisting>
- </para>
-
- <para>
- It is possible to use a different Java compiler than <command>javac</command> from the OpenJDK. For instance, to use the GNU Java Compiler:
-<programlisting>
-nativeBuildInputs = [ gcj ant ];
-</programlisting>
- Here, Ant will automatically use <command>gij</command> (the GNU Java Runtime) instead of the OpenJRE.
- </para>
-</section>
diff --git a/doc/languages-frameworks/ocaml.section.md b/doc/languages-frameworks/ocaml.section.md
new file mode 100644
index 000000000000..1c5a5473a05e
--- /dev/null
+++ b/doc/languages-frameworks/ocaml.section.md
@@ -0,0 +1,70 @@
+# OCaml {#sec-language-ocaml}
+
+OCaml libraries should be installed in `$(out)/lib/ocaml/${ocaml.version}/site-lib/`. Such directories are automatically added to the `$OCAMLPATH` environment variable when building another package that depends on them or when opening a `nix-shell`.
+
+Given that most of the OCaml ecosystem is now built with dune, nixpkgs includes a convenience build support function called `buildDunePackage` that will build an OCaml package using dune, OCaml and findlib and any additional dependencies provided as `buildInputs` or `propagatedBuildInputs`.
+
+Here is a simple package example. It defines an (optional) attribute `minimumOCamlVersion` that will be used to throw a descriptive evaluation error if building with an older OCaml is attempted. It uses the `fetchFromGitHub` fetcher to get its source. It sets the `doCheck` (optional) attribute to `true` which means that tests will be run with `dune runtest -p angstrom` after the build (`dune build -p angstrom`) is complete. It uses `alcotest` as a build input (because it is needed to run the tests) and `bigstringaf` and `result` as propagated build inputs (thus they will also be available to libraries depending on this library). The library will be installed using the `angstrom.install` file that dune generates.
+
+```nix
+{ stdenv
+, fetchFromGitHub
+, buildDunePackage
+, alcotest
+, result
+, bigstringaf
+}:
+
+buildDunePackage rec {
+ pname = "angstrom";
+ version = "0.10.0";
+
+ minimumOCamlVersion = "4.03";
+
+ src = fetchFromGitHub {
+ owner = "inhabitedtype";
+ repo = pname;
+ rev = version;
+ sha256 = "0lh6024yf9ds0nh9i93r9m6p5psi8nvrqxl5x7jwl13zb0r9xfpw";
+ };
+
+ buildInputs = [ alcotest ];
+ propagatedBuildInputs = [ bigstringaf result ];
+ doCheck = true;
+
+ meta = {
+ homepage = "https://github.com/inhabitedtype/angstrom";
+ description = "OCaml parser combinators built for speed and memory efficiency";
+ license = stdenv.lib.licenses.bsd3;
+ maintainers = with stdenv.lib.maintainers; [ sternenseemann ];
+ };
+}
+```
+
+Here is a second example, this time using a source archive generated with `dune-release`. It is a good idea to use this archive when it is available as it will usually contain substituted variables such as a `%%VERSION%%` field. This library does not depend on any other OCaml library and no tests are run after building it.
+
+```nix
+{ stdenv
+, fetchurl
+, buildDunePackage
+}:
+
+buildDunePackage rec {
+ pname = "wtf8";
+ version = "1.0.1";
+
+ minimumOCamlVersion = "4.01";
+
+ src = fetchurl {
+ url = "https://github.com/flowtype/ocaml-${pname}/releases/download/v${version}/${pname}-${version}.tbz";
+ sha256 = "1msg3vycd3k8qqj61sc23qks541cxpb97vrnrvrhjnqxsqnh6ygq";
+ };
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/flowtype/ocaml-wtf8";
+ description = "WTF-8 is a superset of UTF-8 that allows unpaired surrogates.";
+ license = licenses.mit;
+ maintainers = [ maintainers.eqyiel ];
+ };
+}
+```
diff --git a/doc/languages-frameworks/ocaml.xml b/doc/languages-frameworks/ocaml.xml
deleted file mode 100644
index 3f72092ec150..000000000000
--- a/doc/languages-frameworks/ocaml.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-language-ocaml">
- <title>OCaml</title>
-
- <para>
- OCaml libraries should be installed in <literal>$(out)/lib/ocaml/${ocaml.version}/site-lib/</literal>. Such directories are automatically added to the <literal>$OCAMLPATH</literal> environment variable when building another package that depends on them or when opening a <literal>nix-shell</literal>.
- </para>
-
- <para>
- Given that most of the OCaml ecosystem is now built with dune, nixpkgs includes a convenience build support function called <literal>buildDunePackage</literal> that will build an OCaml package using dune, OCaml and findlib and any additional dependencies provided as <literal>buildInputs</literal> or <literal>propagatedBuildInputs</literal>.
- </para>
-
- <para>
- Here is a simple package example. It defines an (optional) attribute <literal>minimumOCamlVersion</literal> that will be used to throw a descriptive evaluation error if building with an older OCaml is attempted. It uses the <literal>fetchFromGitHub</literal> fetcher to get its source. It sets the <literal>doCheck</literal> (optional) attribute to <literal>true</literal> which means that tests will be run with <literal>dune runtest -p angstrom</literal> after the build (<literal>dune build -p angstrom</literal>) is complete. It uses <literal>alcotest</literal> as a build input (because it is needed to run the tests) and <literal>bigstringaf</literal> and <literal>result</literal> as propagated build inputs (thus they will also be available to libraries depending on this library). The library will be installed using the <literal>angstrom.install</literal> file that dune generates.
- </para>
-
-<programlisting>
-{ stdenv, fetchFromGitHub, buildDunePackage, alcotest, result, bigstringaf }:
-
-buildDunePackage rec {
- pname = "angstrom";
- version = "0.10.0";
-
- minimumOCamlVersion = "4.03";
-
- src = fetchFromGitHub {
- owner = "inhabitedtype";
- repo = pname;
- rev = version;
- sha256 = "0lh6024yf9ds0nh9i93r9m6p5psi8nvrqxl5x7jwl13zb0r9xfpw";
- };
-
- buildInputs = [ alcotest ];
- propagatedBuildInputs = [ bigstringaf result ];
- doCheck = true;
-
- meta = {
- homepage = "https://github.com/inhabitedtype/angstrom";
- description = "OCaml parser combinators built for speed and memory efficiency";
- license = stdenv.lib.licenses.bsd3;
- maintainers = with stdenv.lib.maintainers; [ sternenseemann ];
- };
-}
-</programlisting>
-
- <para>
- Here is a second example, this time using a source archive generated with <literal>dune-release</literal>. It is a good idea to use this archive when it is available as it will usually contain substituted variables such as a <literal>%%VERSION%%</literal> field. This library does not depend on any other OCaml library and no tests are run after building it.
- </para>
-
-<programlisting>
-{ stdenv, fetchurl, buildDunePackage }:
-
-buildDunePackage rec {
- pname = "wtf8";
- version = "1.0.1";
-
- minimumOCamlVersion = "4.01";
-
- src = fetchurl {
- url = "https://github.com/flowtype/ocaml-${pname}/releases/download/v${version}/${pname}-${version}.tbz";
- sha256 = "1msg3vycd3k8qqj61sc23qks541cxpb97vrnrvrhjnqxsqnh6ygq";
- };
-
- meta = with stdenv.lib; {
- homepage = "https://github.com/flowtype/ocaml-wtf8";
- description = "WTF-8 is a superset of UTF-8 that allows unpaired surrogates.";
- license = licenses.mit;
- maintainers = [ maintainers.eqyiel ];
- };
-}
-</programlisting>
-</section>
diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md
index 59f7389b9ad3..8a2fe2711c7a 100644
--- a/doc/languages-frameworks/python.section.md
+++ b/doc/languages-frameworks/python.section.md
@@ -153,7 +153,7 @@ The dot product of [1 2] and [3 4] is: 11
But if we maintain the script ourselves, and if there are more dependencies, it
may be nice to encode those dependencies in source to make the script re-usable
without that bit of knowledge. That can be done by using `nix-shell` as a
-[shebang](https://en.wikipedia.org/wiki/Shebang_(Unix), like so:
+[shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)), like so:
```python
#!/usr/bin/env nix-shell
diff --git a/doc/languages-frameworks/qt.section.md b/doc/languages-frameworks/qt.section.md
new file mode 100644
index 000000000000..4a37eb4ef7db
--- /dev/null
+++ b/doc/languages-frameworks/qt.section.md
@@ -0,0 +1,124 @@
+# Qt {#sec-language-qt}
+
+This section describes the differences between Nix expressions for Qt libraries and applications and Nix expressions for other C++ software. Some knowledge of the latter is assumed.
+
+There are primarily two problems which the Qt infrastructure is designed to address: ensuring consistent versioning of all dependencies and finding dependencies at runtime.
+
+## Nix expression for a Qt package (default.nix) {#qt-default-nix}
+
+```{=docbook}
+<programlisting>
+{ mkDerivation, lib, qtbase }: <co xml:id='qt-default-nix-co-1' />
+
+mkDerivation { <co xml:id='qt-default-nix-co-2' />
+ pname = "myapp";
+ version = "1.0";
+
+ buildInputs = [ qtbase ]; <co xml:id='qt-default-nix-co-3' />
+}
+</programlisting>
+
+ <calloutlist>
+ <callout arearefs='qt-default-nix-co-1'>
+ <para>
+ Import <literal>mkDerivation</literal> and Qt (such as <literal>qtbase</literal> modules directly. <emphasis>Do not</emphasis> import Qt package sets; the Qt versions of dependencies may not be coherent, causing build and runtime failures.
+ </para>
+ </callout>
+ <callout arearefs='qt-default-nix-co-2'>
+ <para>
+ Use <literal>mkDerivation</literal> instead of <literal>stdenv.mkDerivation</literal>. <literal>mkDerivation</literal> is a wrapper around <literal>stdenv.mkDerivation</literal> which applies some Qt-specific settings. This deriver accepts the same arguments as <literal>stdenv.mkDerivation</literal>; refer to <xref linkend='chap-stdenv' /> for details.
+ </para>
+ <para>
+ To use another deriver instead of <literal>stdenv.mkDerivation</literal>, use <literal>mkDerivationWith</literal>:
+<programlisting>
+mkDerivationWith myDeriver {
+ # ...
+}
+</programlisting>
+ If you cannot use <literal>mkDerivationWith</literal>, please refer to <xref linkend='qt-runtime-dependencies' />.
+ </para>
+ </callout>
+ <callout arearefs='qt-default-nix-co-3'>
+ <para>
+ <literal>mkDerivation</literal> accepts the same arguments as <literal>stdenv.mkDerivation</literal>, such as <literal>buildInputs</literal>.
+ </para>
+ </callout>
+ </calloutlist>
+```
+
+## Locating runtime dependencies {#qt-runtime-dependencies}
+Qt applications need to be wrapped to find runtime dependencies. If you cannot use `mkDerivation` or `mkDerivationWith` above, include `wrapQtAppsHook` in `nativeBuildInputs`:
+
+```nix
+stdenv.mkDerivation {
+ # ...
+
+ nativeBuildInputs = [ wrapQtAppsHook ];
+}
+```
+Entries added to `qtWrapperArgs` are used to modify the wrappers created by `wrapQtAppsHook`. The entries are passed as arguments to [wrapProgram executable makeWrapperArgs](#fun-wrapProgram).
+
+```nix
+mkDerivation {
+ # ...
+
+ qtWrapperArgs = [ ''--prefix PATH : /path/to/bin'' ];
+}
+```
+
+Set `dontWrapQtApps` to stop applications from being wrapped automatically. It is required to wrap applications manually with `wrapQtApp`, using the syntax of [wrapProgram executable makeWrapperArgs](#fun-wrapProgram):
+
+```nix
+mkDerivation {
+ # ...
+
+ dontWrapQtApps = true;
+ preFixup = ''
+ wrapQtApp "$out/bin/myapp" --prefix PATH : /path/to/bin
+ '';
+}
+```
+
+> Note: `wrapQtAppsHook` ignores files that are non-ELF executables. This means that scripts won't be automatically wrapped so you'll need to manually wrap them as previously mentioned. An example of when you'd always need to do this is with Python applications that use PyQT.
+
+Libraries are built with every available version of Qt. Use the `meta.broken` attribute to disable the package for unsupported Qt versions:
+
+```nix
+mkDerivation {
+ # ...
+
+ # Disable this library with Qt &lt; 5.9.0
+ meta.broken = builtins.compareVersions qtbase.version "5.9.0" &lt; 0;
+}
+```
+## Adding a library to Nixpkgs
+ Add a Qt library to all-packages.nix by adding it to the collection inside `mkLibsForQt5`. This ensures that the library is built with every available version of Qt as needed.
+
+### Example Adding a Qt library to all-packages.nix {#qt-library-all-packages-nix}
+
+```
+{
+ # ...
+
+ mkLibsForQt5 = self: with self; {
+ # ...
+
+ mylib = callPackage ../path/to/mylib {};
+ };
+
+ # ...
+}
+```
+## Adding an application to Nixpkgs
+Add a Qt application to *all-packages.nix* using `libsForQt5.callPackage` instead of the usual `callPackage`. The former ensures that all dependencies are built with the same version of Qt.
+
+### Example Adding a QT application to all-packages.nix {#qt-application-all-packages-nix}
+```nix
+{
+ # ...
+
+ myapp = libsForQt5.callPackage ../path/to/myapp/ {};
+
+ # ...
+}
+```
diff --git a/doc/languages-frameworks/qt.xml b/doc/languages-frameworks/qt.xml
deleted file mode 100644
index ec95621d8ff2..000000000000
--- a/doc/languages-frameworks/qt.xml
+++ /dev/null
@@ -1,149 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-language-qt">
- <title>Qt</title>
-
- <para>
- This section describes the differences between Nix expressions for Qt libraries and applications and Nix expressions for other C++ software. Some knowledge of the latter is assumed. There are primarily two problems which the Qt infrastructure is designed to address: ensuring consistent versioning of all dependencies and finding dependencies at runtime.
- </para>
-
- <example xml:id='qt-default-nix'>
- <title>Nix expression for a Qt package (<filename>default.nix</filename>)</title>
-<programlisting>
-{ mkDerivation, lib, qtbase }: <co xml:id='qt-default-nix-co-1' />
-
-mkDerivation { <co xml:id='qt-default-nix-co-2' />
- pname = "myapp";
- version = "1.0";
-
- buildInputs = [ qtbase ]; <co xml:id='qt-default-nix-co-3' />
-}
-</programlisting>
- </example>
-
- <calloutlist>
- <callout arearefs='qt-default-nix-co-1'>
- <para>
- Import <literal>mkDerivation</literal> and Qt (such as <literal>qtbase</literal> modules directly. <emphasis>Do not</emphasis> import Qt package sets; the Qt versions of dependencies may not be coherent, causing build and runtime failures.
- </para>
- </callout>
- <callout arearefs='qt-default-nix-co-2'>
- <para>
- Use <literal>mkDerivation</literal> instead of <literal>stdenv.mkDerivation</literal>. <literal>mkDerivation</literal> is a wrapper around <literal>stdenv.mkDerivation</literal> which applies some Qt-specific settings. This deriver accepts the same arguments as <literal>stdenv.mkDerivation</literal>; refer to <xref linkend='chap-stdenv' /> for details.
- </para>
- <para>
- To use another deriver instead of <literal>stdenv.mkDerivation</literal>, use <literal>mkDerivationWith</literal>:
-<programlisting>
-mkDerivationWith myDeriver {
- # ...
-}
-</programlisting>
- If you cannot use <literal>mkDerivationWith</literal>, please refer to <xref linkend='qt-runtime-dependencies' />.
- </para>
- </callout>
- <callout arearefs='qt-default-nix-co-3'>
- <para>
- <literal>mkDerivation</literal> accepts the same arguments as <literal>stdenv.mkDerivation</literal>, such as <literal>buildInputs</literal>.
- </para>
- </callout>
- </calloutlist>
-
- <formalpara xml:id='qt-runtime-dependencies'>
- <title>Locating runtime dependencies</title>
- <para>
- Qt applications need to be wrapped to find runtime dependencies. If you cannot use <literal>mkDerivation</literal> or <literal>mkDerivationWith</literal> above, include <literal>wrapQtAppsHook</literal> in <literal>nativeBuildInputs</literal>:
-<programlisting>
-stdenv.mkDerivation {
- # ...
-
- nativeBuildInputs = [ wrapQtAppsHook ];
-}
-</programlisting>
- </para>
- </formalpara>
-
- <para>
- Entries added to <literal>qtWrapperArgs</literal> are used to modify the wrappers created by <literal>wrapQtAppsHook</literal>. The entries are passed as arguments to <xref linkend='fun-wrapProgram' />.
-<programlisting>
-mkDerivation {
- # ...
-
- qtWrapperArgs = [ ''--prefix PATH : /path/to/bin'' ];
-}
-</programlisting>
- </para>
-
- <para>
- Set <literal>dontWrapQtApps</literal> to stop applications from being wrapped automatically. It is required to wrap applications manually with <literal>wrapQtApp</literal>, using the syntax of <xref linkend='fun-wrapProgram' />:
-<programlisting>
-mkDerivation {
- # ...
-
- dontWrapQtApps = true;
- preFixup = ''
- wrapQtApp "$out/bin/myapp" --prefix PATH : /path/to/bin
- '';
-}
-</programlisting>
- </para>
-
- <note>
- <para>
- <literal>wrapQtAppsHook</literal> ignores files that are non-ELF executables. This means that scripts won't be automatically wrapped so you'll need to manually wrap them as previously mentioned. An example of when you'd always need to do this is with Python applications that use PyQT.
- </para>
- </note>
-
- <para>
- Libraries are built with every available version of Qt. Use the <literal>meta.broken</literal> attribute to disable the package for unsupported Qt versions:
-<programlisting>
-mkDerivation {
- # ...
-
- # Disable this library with Qt &lt; 5.9.0
- meta.broken = builtins.compareVersions qtbase.version "5.9.0" &lt; 0;
-}
-</programlisting>
- </para>
-
- <formalpara>
- <title>Adding a library to Nixpkgs</title>
- <para>
- Add a Qt library to <filename>all-packages.nix</filename> by adding it to the collection inside <literal>mkLibsForQt5</literal>. This ensures that the library is built with every available version of Qt as needed.
- <example xml:id='qt-library-all-packages-nix'>
- <title>Adding a Qt library to <filename>all-packages.nix</filename></title>
-<programlisting>
-{
- # ...
-
- mkLibsForQt5 = self: with self; {
- # ...
-
- mylib = callPackage ../path/to/mylib {};
- };
-
- # ...
-}
-</programlisting>
- </example>
- </para>
- </formalpara>
-
- <formalpara>
- <title>Adding an application to Nixpkgs</title>
- <para>
- Add a Qt application to <filename>all-packages.nix</filename> using <literal>libsForQt5.callPackage</literal> instead of the usual <literal>callPackage</literal>. The former ensures that all dependencies are built with the same version of Qt.
- <example xml:id='qt-application-all-packages-nix'>
- <title>Adding a Qt application to <filename>all-packages.nix</filename></title>
-<programlisting>
-{
- # ...
-
- myapp = libsForQt5.callPackage ../path/to/myapp/ {};
-
- # ...
-}
-</programlisting>
- </example>
- </para>
- </formalpara>
-</section>
diff --git a/doc/languages-frameworks/ruby.section.md b/doc/languages-frameworks/ruby.section.md
index e4c4ffce0432..e292b3110ff4 100644
--- a/doc/languages-frameworks/ruby.section.md
+++ b/doc/languages-frameworks/ruby.section.md
@@ -1,74 +1,38 @@
----
-title: Ruby
-author: Michael Fellinger
-date: 2019-05-23
----
+# Ruby {#sec-language-ruby}
-# Ruby
+## Using Ruby
-## User Guide
+Several versions of Ruby interpreters are available on Nix, as well as over 250 gems and many applications written in Ruby. The attribute `ruby` refers to the default Ruby interpreter, which is currently MRI 2.6. It's also possible to refer to specific versions, e.g. `ruby_2_y`, `jruby`, or `mruby`.
-### Using Ruby
+In the Nixpkgs tree, Ruby packages can be found throughout, depending on what they do, and are called from the main package set. Ruby gems, however are separate sets, and there's one default set for each interpreter (currently MRI only).
-#### Overview
+There are two main approaches for using Ruby with gems. One is to use a specifically locked `Gemfile` for an application that has very strict dependencies. The other is to depend on the common gems, which we'll explain further down, and rely on them being updated regularly.
-Several versions of Ruby interpreters are available on Nix, as well as over 250 gems and many applications written in Ruby.
-The attribute `ruby` refers to the default Ruby interpreter, which is currently
-MRI 2.5. It's also possible to refer to specific versions, e.g. `ruby_2_6`, `jruby`, or `mruby`.
+The interpreters have common attributes, namely `gems`, and `withPackages`. So you can refer to `ruby.gems.nokogiri`, or `ruby_2_6.gems.nokogiri` to get the Nokogiri gem already compiled and ready to use.
-In the nixpkgs tree, Ruby packages can be found throughout, depending on what
-they do, and are called from the main package set. Ruby gems, however are
-separate sets, and there's one default set for each interpreter (currently MRI
-only).
+Since not all gems have executables like `nokogiri`, it's usually more convenient to use the `withPackages` function like this: `ruby.withPackages (p: with p; [ nokogiri ])`. This will also make sure that the Ruby in your environment will be able to find the gem and it can be used in your Ruby code (for example via `ruby` or `irb` executables) via `require "nokogiri"` as usual.
-There are two main approaches for using Ruby with gems.
-One is to use a specifically locked `Gemfile` for an application that has very strict dependencies.
-The other is to depend on the common gems, which we'll explain further down, and
-rely on them being updated regularly.
+### Temporary Ruby environment with `nix-shell`
-The interpreters have common attributes, namely `gems`, and `withPackages`. So
-you can refer to `ruby.gems.nokogiri`, or `ruby_2_5.gems.nokogiri` to get the
-Nokogiri gem already compiled and ready to use.
+Rather than having a single Ruby environment shared by all Ruby development projects on a system, Nix allows you to create separate environments per project. `nix-shell` gives you the possibility to temporarily load another environment akin to a combined `chruby` or `rvm` and `bundle exec`.
-Since not all gems have executables like `nokogiri`, it's usually more
-convenient to use the `withPackages` function like this:
-`ruby.withPackages (p: with p; [ nokogiri ])`. This will also make sure that the
-Ruby in your environment will be able to find the gem and it can be used in your
-Ruby code (for example via `ruby` or `irb` executables) via `require "nokogiri"`
-as usual.
+There are two methods for loading a shell with Ruby packages. The first and recommended method is to create an environment with `ruby.withPackages` and load that.
-#### Temporary Ruby environment with `nix-shell`
-
-Rather than having a single Ruby environment shared by all Ruby
-development projects on a system, Nix allows you to create separate
-environments per project. `nix-shell` gives you the possibility to
-temporarily load another environment akin to a combined `chruby` or
-`rvm` and `bundle exec`.
-
-There are two methods for loading a shell with Ruby packages. The first and
-recommended method is to create an environment with `ruby.withPackages` and load
-that.
-
-```shell
-nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])"
+```ShellSession
+$ nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])"
```
-The other method, which is not recommended, is to create an environment and list
-all the packages directly.
+The other method, which is not recommended, is to create an environment and list all the packages directly.
-```shell
-nix-shell -p ruby.gems.nokogiri ruby.gems.pry
+```ShellSession
+$ nix-shell -p ruby.gems.nokogiri ruby.gems.pry
```
-Again, it's possible to launch the interpreter from the shell. The Ruby
-interpreter has the attribute `gems` which contains all Ruby gems for that
-specific interpreter.
+Again, it's possible to launch the interpreter from the shell. The Ruby interpreter has the attribute `gems` which contains all Ruby gems for that specific interpreter.
-##### Load environment from `.nix` expression
+#### Load Ruby environment from `.nix` expression
-As explained in the Nix manual, `nix-shell` can also load an expression from a
-`.nix` file. Say we want to have Ruby 2.5, `nokogori`, and `pry`. Consider a
-`shell.nix` file with:
+As explained in the Nix manual, `nix-shell` can also load an expression from a `.nix` file. Say we want to have Ruby 2.6, `nokogori`, and `pry`. Consider a `shell.nix` file with:
```nix
with import <nixpkgs> {};
@@ -77,43 +41,33 @@ ruby.withPackages (ps: with ps; [ nokogiri pry ])
What's happening here?
-1. We begin with importing the Nix Packages collections. `import <nixpkgs>`
- imports the `<nixpkgs>` function, `{}` calls it and the `with` statement
- brings all attributes of `nixpkgs` in the local scope. These attributes form
- the main package set.
+1. We begin with importing the Nix Packages collections. `import <nixpkgs>` imports the `<nixpkgs>` function, `{}` calls it and the `with` statement brings all attributes of `nixpkgs` in the local scope. These attributes form the main package set.
2. Then we create a Ruby environment with the `withPackages` function.
-3. The `withPackages` function expects us to provide a function as an argument
- that takes the set of all ruby gems and returns a list of packages to include
- in the environment. Here, we select the packages `nokogiri` and `pry` from
- the package set.
+3. The `withPackages` function expects us to provide a function as an argument that takes the set of all ruby gems and returns a list of packages to include in the environment. Here, we select the packages `nokogiri` and `pry` from the package set.
-##### Execute command with `--run`
+#### Execute command with `--run`
-A convenient flag for `nix-shell` is `--run`. It executes a command in the
-`nix-shell`. We can e.g. directly open a `pry` REPL:
+A convenient flag for `nix-shell` is `--run`. It executes a command in the `nix-shell`. We can e.g. directly open a `pry` REPL:
-```shell
-nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])" --run "pry"
+```ShellSession
+$ nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])" --run "pry"
```
Or immediately require `nokogiri` in pry:
-```shell
-nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])" --run "pry -rnokogiri"
+```ShellSession
+$ nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])" --run "pry -rnokogiri"
```
Or run a script using this environment:
-```shell
-nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])" --run "ruby example.rb"
+```ShellSession
+$ nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])" --run "ruby example.rb"
```
-##### Using `nix-shell` as shebang
+#### Using `nix-shell` as shebang
-In fact, for the last case, there is a more convenient method. You can add a
-[shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) to your script
-specifying which dependencies `nix-shell` needs. With the following shebang, you
-can just execute `./example.rb`, and it will run with all dependencies.
+In fact, for the last case, there is a more convenient method. You can add a [shebang](<https://en.wikipedia.org/wiki/Shebang_(Unix)>) to your script specifying which dependencies `nix-shell` needs. With the following shebang, you can just execute `./example.rb`, and it will run with all dependencies.
```ruby
#! /usr/bin/env nix-shell
@@ -126,35 +80,24 @@ body = RestClient.get('http://example.com').body
puts Nokogiri::HTML(body).at('h1').text
```
-### Developing with Ruby
+## Developing with Ruby
-#### Using an existing Gemfile
+### Using an existing Gemfile
-In most cases, you'll already have a `Gemfile.lock` listing all your dependencies.
-This can be used to generate a `gemset.nix` which is used to fetch the gems and
-combine them into a single environment.
-The reason why you need to have a separate file for this, is that Nix requires
-you to have a checksum for each input to your build.
-Since the `Gemfile.lock` that `bundler` generates doesn't provide us with
-checksums, we have to first download each gem, calculate its SHA256, and store
-it in this separate file.
+In most cases, you'll already have a `Gemfile.lock` listing all your dependencies. This can be used to generate a `gemset.nix` which is used to fetch the gems and combine them into a single environment. The reason why you need to have a separate file for this, is that Nix requires you to have a checksum for each input to your build. Since the `Gemfile.lock` that `bundler` generates doesn't provide us with checksums, we have to first download each gem, calculate its SHA256, and store it in this separate file.
So the steps from having just a `Gemfile` to a `gemset.nix` are:
-```shell
-bundle lock
-bundix
+```ShellSession
+$ bundle lock
+$ bundix
```
-If you already have a `Gemfile.lock`, you can simply run `bundix` and it will
-work the same.
+If you already have a `Gemfile.lock`, you can simply run `bundix` and it will work the same.
-To update the gems in your `Gemfile.lock`, you may use the `bundix -l` flag,
-which will create a new `Gemfile.lock` in case the `Gemfile` has a more recent
-time of modification.
+To update the gems in your `Gemfile.lock`, you may use the `bundix -l` flag, which will create a new `Gemfile.lock` in case the `Gemfile` has a more recent time of modification.
-Once the `gemset.nix` is generated, it can be used in a
-`bundlerEnv` derivation. Here is an example you could use for your `shell.nix`:
+Once the `gemset.nix` is generated, it can be used in a `bundlerEnv` derivation. Here is an example you could use for your `shell.nix`:
```nix
# ...
@@ -166,41 +109,26 @@ let
in mkShell { buildInputs = [ gems gems.wrappedRuby ]; }
```
-With this file in your directory, you can run `nix-shell` to build and use the gems.
-The important parts here are `bundlerEnv` and `wrappedRuby`.
+With this file in your directory, you can run `nix-shell` to build and use the gems. The important parts here are `bundlerEnv` and `wrappedRuby`.
-The `bundlerEnv` is a wrapper over all the gems in your gemset. This means that
-all the `/lib` and `/bin` directories will be available, and the executables of
-all gems (even of indirect dependencies) will end up in your `$PATH`.
-The `wrappedRuby` provides you with all executables that come with Ruby itself,
-but wrapped so they can easily find the gems in your gemset.
+The `bundlerEnv` is a wrapper over all the gems in your gemset. This means that all the `/lib` and `/bin` directories will be available, and the executables of all gems (even of indirect dependencies) will end up in your `$PATH`. The `wrappedRuby` provides you with all executables that come with Ruby itself, but wrapped so they can easily find the gems in your gemset.
-One common issue that you might have is that you have Ruby 2.6, but also
-`bundler` in your gemset. That leads to a conflict for `/bin/bundle` and
-`/bin/bundler`. You can resolve this by wrapping either your Ruby or your gems
-in a `lowPrio` call. So in order to give the `bundler` from your gemset
-priority, it would be used like this:
+One common issue that you might have is that you have Ruby 2.6, but also `bundler` in your gemset. That leads to a conflict for `/bin/bundle` and `/bin/bundler`. You can resolve this by wrapping either your Ruby or your gems in a `lowPrio` call. So in order to give the `bundler` from your gemset priority, it would be used like this:
```nix
# ...
mkShell { buildInputs = [ gems (lowPrio gems.wrappedRuby) ]; }
```
+### Gem-specific configurations and workarounds
-#### Gem-specific configurations and workarounds
+In some cases, especially if the gem has native extensions, you might need to modify the way the gem is built.
-In some cases, especially if the gem has native extensions, you might need to
-modify the way the gem is built.
+This is done via a common configuration file that includes all of the workarounds for each gem.
-This is done via a common configuration file that includes all of the
-workarounds for each gem.
+This file lives at `/pkgs/development/ruby-modules/gem-config/default.nix`, since it already contains a lot of entries, it should be pretty easy to add the modifications you need for your needs.
-This file lives at `/pkgs/development/ruby-modules/gem-config/default.nix`,
-since it already contains a lot of entries, it should be pretty easy to add the
-modifications you need for your needs.
-
-In the meanwhile, or if the modification is for a private gem, you can also add
-the configuration to only your own environment.
+In the meanwhile, or if the modification is for a private gem, you can also add the configuration to only your own environment.
Two places that allow this modification are the `ruby` derivation, or `bundlerEnv`.
@@ -261,10 +189,9 @@ let
in pkgs.ruby.withPackages (ps: with ps; [ pg ])
```
-Then we can get whichever postgresql version we desire and the `pg` gem will
-always reference it correctly:
+Then we can get whichever postgresql version we desire and the `pg` gem will always reference it correctly:
-```shell
+```ShellSession
$ nix-shell --argstr pg_version 9_4 --run 'ruby -rpg -e "puts PG.library_version"'
90421
@@ -272,24 +199,15 @@ $ nix-shell --run 'ruby -rpg -e "puts PG.library_version"'
100007
```
-Of course for this use-case one could also use overlays since the configuration
-for `pg` depends on the `postgresql` alias, but for demonstration purposes this
-has to suffice.
+Of course for this use-case one could also use overlays since the configuration for `pg` depends on the `postgresql` alias, but for demonstration purposes this has to suffice.
-#### Adding a gem to the default gemset
+### Adding a gem to the default gemset
-Now that you know how to get a working Ruby environment with Nix, it's time to
-go forward and start actually developing with Ruby.
-We will first have a look at how Ruby gems are packaged on Nix. Then, we will
-look at how you can use development mode with your code.
+Now that you know how to get a working Ruby environment with Nix, it's time to go forward and start actually developing with Ruby. We will first have a look at how Ruby gems are packaged on Nix. Then, we will look at how you can use development mode with your code.
-All gems in the standard set are automatically generated from a single
-`Gemfile`. The dependency resolution is done with `bundler` and makes it more
-likely that all gems are compatible to each other.
+All gems in the standard set are automatically generated from a single `Gemfile`. The dependency resolution is done with `bundler` and makes it more likely that all gems are compatible to each other.
-In order to add a new gem to nixpkgs, you can put it into the
-`/pkgs/development/ruby-modules/with-packages/Gemfile` and run
-`./maintainers/scripts/update-ruby-packages`.
+In order to add a new gem to nixpkgs, you can put it into the `/pkgs/development/ruby-modules/with-packages/Gemfile` and run `./maintainers/scripts/update-ruby-packages`.
To test that it works, you can then try using the gem with:
@@ -297,16 +215,11 @@ To test that it works, you can then try using the gem with:
NIX_PATH=nixpkgs=$PWD nix-shell -p "ruby.withPackages (ps: with ps; [ name-of-your-gem ])"
```
-#### Packaging applications
+### Packaging applications
-A common task is to add a ruby executable to nixpkgs, popular examples would be
-`chef`, `jekyll`, or `sass`. A good way to do that is to use the `bundlerApp`
-function, that allows you to make a package that only exposes the listed
-executables, otherwise the package may cause conflicts through common paths like
-`bin/rake` or `bin/bundler` that aren't meant to be used.
+A common task is to add a ruby executable to nixpkgs, popular examples would be `chef`, `jekyll`, or `sass`. A good way to do that is to use the `bundlerApp` function, that allows you to make a package that only exposes the listed executables, otherwise the package may cause conflicts through common paths like `bin/rake` or `bin/bundler` that aren't meant to be used.
-The absolute easiest way to do that is to write a
-`Gemfile` along these lines:
+The absolute easiest way to do that is to write a `Gemfile` along these lines:
```ruby
source 'https://rubygems.org' do
@@ -314,10 +227,7 @@ source 'https://rubygems.org' do
end
```
-If you want to package a specific version, you can use the standard Gemfile
-syntax for that, e.g. `gem 'mdl', '0.5.0'`, but if you want the latest stable
-version anyway, it's easier to update by simply running the `bundle lock` and
-`bundix` steps again.
+If you want to package a specific version, you can use the standard Gemfile syntax for that, e.g. `gem 'mdl', '0.5.0'`, but if you want the latest stable version anyway, it's easier to update by simply running the `bundle lock` and `bundix` steps again.
Now you can also also make a `default.nix` that looks like this:
@@ -331,20 +241,15 @@ bundlerApp {
}
```
-All that's left to do is to generate the corresponding `Gemfile.lock` and
-`gemset.nix` as described above in the `Using an existing Gemfile` section.
+All that's left to do is to generate the corresponding `Gemfile.lock` and `gemset.nix` as described above in the `Using an existing Gemfile` section.
-##### Packaging executables that require wrapping
+#### Packaging executables that require wrapping
-Sometimes your app will depend on other executables at runtime, and tries to
-find it through the `PATH` environment variable.
+Sometimes your app will depend on other executables at runtime, and tries to find it through the `PATH` environment variable.
-In this case, you can provide a `postBuild` hook to `bundlerApp` that wraps the
-gem in another script that prefixes the `PATH`.
+In this case, you can provide a `postBuild` hook to `bundlerApp` that wraps the gem in another script that prefixes the `PATH`.
-Of course you could also make a custom `gemConfig` if you know exactly how to
-patch it, but it's usually much easier to maintain with a simple wrapper so the
-patch doesn't have to be adjusted for each version.
+Of course you could also make a custom `gemConfig` if you know exactly how to patch it, but it's usually much easier to maintain with a simple wrapper so the patch doesn't have to be adjusted for each version.
Here's another example:
diff --git a/doc/languages-frameworks/ruby.xml b/doc/languages-frameworks/ruby.xml
deleted file mode 100644
index 9b579d6804f4..000000000000
--- a/doc/languages-frameworks/ruby.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-language-ruby">
- <title>Ruby</title>
-
- <para>
- There currently is support to bundle applications that are packaged as Ruby gems. The utility "bundix" allows you to write a <filename>Gemfile</filename>, let bundler create a <filename>Gemfile.lock</filename>, and then convert this into a nix expression that contains all Gem dependencies automatically.
- </para>
-
- <para>
- For example, to package sensu, we did:
- </para>
-
-<screen>
-<prompt>$ </prompt>cd pkgs/servers/monitoring
-<prompt>$ </prompt>mkdir sensu
-<prompt>$ </prompt>cd sensu
-<prompt>$ </prompt>cat > Gemfile
-source 'https://rubygems.org'
-gem 'sensu'
-<prompt>$ </prompt>$(nix-build '&lt;nixpkgs>' -A bundix --no-out-link)/bin/bundix --magic
-<prompt>$ </prompt>cat > default.nix
-{ lib, bundlerEnv, ruby }:
-
-bundlerEnv rec {
- name = "sensu-${version}";
-
- version = (import gemset).sensu.version;
- inherit ruby;
- # expects Gemfile, Gemfile.lock and gemset.nix in the same directory
- gemdir = ./.;
-
- meta = with lib; {
- description = "A monitoring framework that aims to be simple, malleable, and scalable";
- homepage = "http://sensuapp.org/";
- license = with licenses; mit;
- maintainers = with maintainers; [ theuni ];
- platforms = platforms.unix;
- };
-}
-</screen>
-
- <para>
- Please check in the <filename>Gemfile</filename>, <filename>Gemfile.lock</filename> and the <filename>gemset.nix</filename> so future updates can be run easily.
- </para>
-
- <para>
- Updating Ruby packages can then be done like this:
- </para>
-
-<screen>
-<prompt>$ </prompt>cd pkgs/servers/monitoring/sensu
-<prompt>$ </prompt>nix-shell -p bundler --run 'bundle lock --update'
-<prompt>$ </prompt>nix-shell -p bundix --run 'bundix'
-</screen>
-
- <para>
- For tools written in Ruby - i.e. where the desire is to install a package and then execute e.g. <command>rake</command> at the command line, there is an alternative builder called <literal>bundlerApp</literal>. Set up the <filename>gemset.nix</filename> the same way, and then, for example:
- </para>
-
-<programlisting>
-<![CDATA[{ lib, bundlerApp }:
-
-bundlerApp {
- pname = "corundum";
- gemdir = ./.;
- exes = [ "corundum-skel" ];
-
- meta = with lib; {
- description = "Tool and libraries for maintaining Ruby gems.";
- homepage = "https://github.com/nyarly/corundum";
- license = licenses.mit;
- maintainers = [ maintainers.nyarly ];
- platforms = platforms.unix;
- };
-}]]>
-</programlisting>
-
- <para>
- The chief advantage of <literal>bundlerApp</literal> over <literal>bundlerEnv</literal> is the executables introduced in the environment are precisely those selected in the <literal>exes</literal> list, as opposed to <literal>bundlerEnv</literal> which adds all the executables made available by gems in the gemset, which can mean e.g. <command>rspec</command> or <command>rake</command> in unpredictable versions available from various packages.
- </para>
-
- <para>
- Resulting derivations for both builders also have two helpful attributes, <literal>env</literal> and <literal>wrappedRuby</literal>. The first one allows one to quickly drop into <command>nix-shell</command> with the specified environment present. E.g. <command>nix-shell -A sensu.env</command> would give you an environment with Ruby preset so it has all the libraries necessary for <literal>sensu</literal> in its paths. The second one can be used to make derivations from custom Ruby scripts which have <filename>Gemfile</filename>s with their dependencies specified. It is a derivation with <command>ruby</command> wrapped so it can find all the needed dependencies. For example, to make a derivation <literal>my-script</literal> for a <filename>my-script.rb</filename> (which should be placed in <filename>bin</filename>) you should run <command>bundix</command> as specified above and then use <literal>bundlerEnv</literal> like this:
- </para>
-
-<programlisting>
-<![CDATA[let env = bundlerEnv {
- name = "my-script-env";
-
- inherit ruby;
- gemfile = ./Gemfile;
- lockfile = ./Gemfile.lock;
- gemset = ./gemset.nix;
-};
-
-in stdenv.mkDerivation {
- name = "my-script";
- buildInputs = [ env.wrappedRuby ];
- script = ./my-script.rb;
- buildCommand = ''
- install -D -m755 $script $out/bin/my-script
- patchShebangs $out/bin/my-script
- '';
-}]]>
-</programlisting>
-</section>
diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md
index 400f39c345cd..0230993d3f08 100644
--- a/doc/languages-frameworks/rust.section.md
+++ b/doc/languages-frameworks/rust.section.md
@@ -63,9 +63,52 @@ The fetcher will verify that the `Cargo.lock` file is in sync with the `src`
attribute, and fail the build if not. It will also will compress the vendor
directory into a tar.gz archive.
-### Building a crate for a different target
-
-To build your crate with a different cargo `--target` simply specify the `target` attribute:
+### Cross compilation
+
+By default, Rust packages are compiled for the host platform, just like any
+other package is. The `--target` passed to rust tools is computed from this.
+By default, it takes the `stdenv.hostPlatform.config` and replaces components
+where they are known to differ. But there are ways to customize the argument:
+
+ - To choose a different target by name, define
+ `stdenv.hostPlatform.rustc.config` as that name (a string), and that
+ name will be used instead.
+
+ For example:
+ ```nix
+ import <nixpkgs> {
+ crossSystem = (import <nixpkgs/lib>).systems.examples.armhf-embedded // {
+ rustc.config = "thumbv7em-none-eabi";
+ };
+ }
+ ```
+ will result in:
+ ```shell
+ --target thumbv7em-none-eabi
+ ```
+
+ - To pass a completely custom target, define
+ `stdenv.hostPlatform.rustc.config` with its name, and
+ `stdenv.hostPlatform.rustc.platform` with the value. The value will be
+ serialized to JSON in a file called
+ `${stdenv.hostPlatform.rustc.config}.json`, and the path of that file
+ will be used instead.
+
+ For example:
+ ```nix
+ import <nixpkgs> {
+ crossSystem = (import <nixpkgs/lib>).systems.examples.armhf-embedded // {
+ rustc.config = "thumb-crazy";
+ rustc.platform = { foo = ""; bar = ""; };
+ };
+ }
+ will result in:
+ ```shell
+ --target /nix/store/asdfasdfsadf-thumb-crazy.json # contains {"foo":"","bar":""}
+ ```
+
+Finally, as an ad-hoc escape hatch, a computed target (string or JSON file
+path) can be passed directly to `buildRustPackage`:
```nix
pkgs.rustPlatform.buildRustPackage {
@@ -74,6 +117,15 @@ pkgs.rustPlatform.buildRustPackage {
}
```
+This is useful to avoid rebuilding Rust tools, since they are actually target
+agnostic and don't need to be rebuilt. But in the future, we should always
+build the Rust tools and standard library crates separately so there is no
+reason not to take the `stdenv.hostPlatform.rustc`-modifying approach, and the
+ad-hoc escape hatch to `buildRustPackage` can be removed.
+
+Note that currently custom targets aren't compiled with `std`, so `cargo test`
+will fail. This can be ignored by adding `doCheck = false;` to your derivation.
+
### Running package tests
When using `buildRustPackage`, the `checkPhase` is enabled by default and runs
@@ -524,12 +576,13 @@ For example, you might want to add `latest.rustChannels.stable.rust` to the list
Imperatively, the latest stable version can be installed with the following command:
- $ nix-env -Ai nixos.latest.rustChannels.stable.rust
+ $ nix-env -Ai nixpkgs.latest.rustChannels.stable.rust
Or using the attribute with nix-shell:
- $ nix-shell -p nixos.latest.rustChannels.stable.rust
+ $ nix-shell -p nixpkgs.latest.rustChannels.stable.rust
+Substitute the `nixpkgs` prefix with `nixos` on NixOS.
To install the beta or nightly channel, "stable" should be substituted by
"nightly" or "beta", or
use the function provided by this overlay to pull a version based on a
diff --git a/doc/languages-frameworks/texlive.section.md b/doc/languages-frameworks/texlive.section.md
new file mode 100644
index 000000000000..9584c56bb52f
--- /dev/null
+++ b/doc/languages-frameworks/texlive.section.md
@@ -0,0 +1,128 @@
+
+# TeX Live {#sec-language-texlive}
+
+Since release 15.09 there is a new TeX Live packaging that lives entirely under attribute `texlive`.
+
+## User's guide {#sec-language-texlive-user-guide}
+
+- For basic usage just pull `texlive.combined.scheme-basic` for an environment with basic LaTeX support.
+- It typically won't work to use separately installed packages together. Instead, you can build a custom set of packages like this:
+
+ ```nix
+ texlive.combine {
+ inherit (texlive) scheme-small collection-langkorean algorithms cm-super;
+ }
+ ```
+
+- There are all the schemes, collections and a few thousand packages, as defined upstream (perhaps with tiny differences).
+- By default you only get executables and files needed during runtime, and a little documentation for the core packages. To change that, you need to add `pkgFilter` function to `combine`.
+
+ ```nix
+ texlive.combine {
+ # inherit (texlive) whatever-you-want;
+ pkgFilter = pkg:
+ pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "cm-super";
+ # elem tlType [ "run" "bin" "doc" "source" ]
+ # there are also other attributes: version, name
+ }
+ ```
+
+- You can list packages e.g. by `nix repl`.
+
+ ```ShellSession
+ $ nix repl
+ nix-repl> :l <nixpkgs>
+ nix-repl> texlive.collection-[TAB]
+ ```
+
+- Note that the wrapper assumes that the result has a chance to be useful. For example, the core executables should be present, as well as some core data files. The supported way of ensuring this is by including some scheme, for example `scheme-basic`, into the combination.
+
+## Custom packages {#sec-language-texlive-custom-packages}
+
+
+You may find that you need to use an external TeX package. A derivation for such package has to provide contents of the "texmf" directory in its output and provide the `tlType` attribute. Here is a (very verbose) example:
+
+```nix
+with import <nixpkgs> {};
+
+let
+ foiltex_run = stdenvNoCC.mkDerivation {
+ pname = "latex-foiltex";
+ version = "2.1.4b";
+ passthru.tlType = "run";
+
+ srcs = [
+ (fetchurl {
+ url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.dtx";
+ sha256 = "07frz0krpz7kkcwlayrwrj2a2pixmv0icbngyw92srp9fp23cqpz";
+ })
+ (fetchurl {
+ url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.ins";
+ sha256 = "09wkyidxk3n3zvqxfs61wlypmbhi1pxmjdi1kns9n2ky8ykbff99";
+ })
+ ];
+
+ unpackPhase = ''
+ runHook preUnpack
+
+ for _src in $srcs; do
+ cp "$_src" $(stripHash "$_src")
+ done
+
+ runHook postUnpack
+ '';
+
+ nativeBuildInputs = [ texlive.combined.scheme-small ];
+
+ dontConfigure = true;
+
+ buildPhase = ''
+ runHook preBuild
+
+ # Generate the style files
+ latex foiltex.ins
+
+ runHook postBuild
+ '';
+
+ installPhase = ''
+ runHook preInstall
+
+ path="$out/tex/latex/foiltex"
+ mkdir -p "$path"
+ cp *.{cls,def,clo} "$path/"
+
+ runHook postInstall
+ '';
+
+ meta = with lib; {
+ description = "A LaTeX2e class for overhead transparencies";
+ license = licenses.unfreeRedistributable;
+ maintainers = with maintainers; [ veprbl ];
+ platforms = platforms.all;
+ };
+ };
+ foiltex = { pkgs = [ foiltex_run ]; };
+
+ latex_with_foiltex = texlive.combine {
+ inherit (texlive) scheme-small;
+ inherit foiltex;
+ };
+in
+ runCommand "test.pdf" {
+ nativeBuildInputs = [ latex_with_foiltex ];
+ } ''
+cat >test.tex <<EOF
+\documentclass{foils}
+
+\title{Presentation title}
+\date{}
+
+\begin{document}
+\maketitle
+\end{document}
+EOF
+ pdflatex test.tex
+ cp test.pdf $out
+''
+```
diff --git a/doc/languages-frameworks/texlive.xml b/doc/languages-frameworks/texlive.xml
deleted file mode 100644
index 141c46e5a623..000000000000
--- a/doc/languages-frameworks/texlive.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-<section xmlns="http://docbook.org/ns/docbook"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xml:id="sec-language-texlive">
- <title>TeX Live</title>
-
- <para>
- Since release 15.09 there is a new TeX Live packaging that lives entirely under attribute <varname>texlive</varname>.
- </para>
-
- <section xml:id="sec-language-texlive-users-guide">
- <title>User's guide</title>
-
- <itemizedlist>
- <listitem>
- <para>
- For basic usage just pull <varname>texlive.combined.scheme-basic</varname> for an environment with basic LaTeX support.
- </para>
- </listitem>
- <listitem>
- <para>
- It typically won't work to use separately installed packages together. Instead, you can build a custom set of packages like this:
-<programlisting>
-texlive.combine {
- inherit (texlive) scheme-small collection-langkorean algorithms cm-super;
-}
-</programlisting>
- There are all the schemes, collections and a few thousand packages, as defined upstream (perhaps with tiny differences).
- </para>
- </listitem>
- <listitem>
- <para>
- By default you only get executables and files needed during runtime, and a little documentation for the core packages. To change that, you need to add <varname>pkgFilter</varname> function to <varname>combine</varname>.
-<programlisting>
-texlive.combine {
- # inherit (texlive) whatever-you-want;
- pkgFilter = pkg:
- pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "cm-super";
- # elem tlType [ "run" "bin" "doc" "source" ]
- # there are also other attributes: version, name
-}
-</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- You can list packages e.g. by <command>nix repl</command>.
-<programlisting>
-<prompt>$ </prompt>nix repl
-<prompt>nix-repl> </prompt>:l &lt;nixpkgs>
-<prompt>nix-repl> </prompt>texlive.collection-<keycap function="tab" />
-</programlisting>
- </para>
- </listitem>
- <listitem>
- <para>
- Note that the wrapper assumes that the result has a chance to be useful. For example, the core executables should be present, as well as some core data files. The supported way of ensuring this is by including some scheme, for example <varname>scheme-basic</varname>, into the combination.
- </para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section xml:id="sec-language-texlive-custom-packages">
- <title>Custom packages</title>
- <para>
- You may find that you need to use an external TeX package. A derivation for such package has to provide contents of the "texmf" directory in its output and provide the <varname>tlType</varname> attribute. Here is a (very verbose) example:
-<programlisting><![CDATA[
-with import <nixpkgs> {};
-
-let
- foiltex_run = stdenvNoCC.mkDerivation {
- pname = "latex-foiltex";
- version = "2.1.4b";
- passthru.tlType = "run";
-
- srcs = [
- (fetchurl {
- url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.dtx";
- sha256 = "07frz0krpz7kkcwlayrwrj2a2pixmv0icbngyw92srp9fp23cqpz";
- })
- (fetchurl {
- url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.ins";
- sha256 = "09wkyidxk3n3zvqxfs61wlypmbhi1pxmjdi1kns9n2ky8ykbff99";
- })
- ];
-
- unpackPhase = ''
- runHook preUnpack
-
- for _src in $srcs; do
- cp "$_src" $(stripHash "$_src")
- done
-
- runHook postUnpack
- '';
-
- nativeBuildInputs = [ texlive.combined.scheme-small ];
-
- dontConfigure = true;
-
- buildPhase = ''
- runHook preBuild
-
- # Generate the style files
- latex foiltex.ins
-
- runHook postBuild
- '';
-
- installPhase = ''
- runHook preInstall
-
- path="$out/tex/latex/foiltex"
- mkdir -p "$path"
- cp *.{cls,def,clo} "$path/"
-
- runHook postInstall
- '';
-
- meta = with lib; {
- description = "A LaTeX2e class for overhead transparencies";
- license = licenses.unfreeRedistributable;
- maintainers = with maintainers; [ veprbl ];
- platforms = platforms.all;
- };
- };
- foiltex = { pkgs = [ foiltex_run ]; };
-
- latex_with_foiltex = texlive.combine {
- inherit (texlive) scheme-small;
- inherit foiltex;
- };
-in
- runCommand "test.pdf" {
- nativeBuildInputs = [ latex_with_foiltex ];
- } ''
-cat >test.tex <<EOF
-\documentclass{foils}
-
-\title{Presentation title}
-\date{}
-
-\begin{document}
-\maketitle
-\end{document}
-EOF
- pdflatex test.tex
- cp test.pdf $out
-''
-]]></programlisting>
- </para>
- </section>
-</section>
diff --git a/doc/stdenv/meta.xml b/doc/stdenv/meta.xml
index 9cef9360002c..c9d1b1362193 100644
--- a/doc/stdenv/meta.xml
+++ b/doc/stdenv/meta.xml
@@ -189,8 +189,7 @@ hello-2.3 A program that produces a familiar, friendly greeting
</term>
<listitem>
<para>
- A list of names and e-mail addresses of the maintainers of this Nix expression. If you would like to be a maintainer of a package, you may want to add yourself to <link
- xlink:href="https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix"><filename>nixpkgs/maintainers/maintainer-list.nix</filename></link> and write something like <literal>[ stdenv.lib.maintainers.alice stdenv.lib.maintainers.bob ]</literal>.
+ A list of the maintainers of this Nix expression. Maintainers are defined in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix"><filename>nixpkgs/maintainers/maintainer-list.nix</filename></link>. There is no restriction to becoming a maintainer, just add yourself to that list in a separate commit titled 'maintainers: add alice', and reference maintainers with <literal>maintainers = with lib.maintainers; [ alice bob ]</literal>.
</para>
</listitem>
</varlistentry>
diff --git a/doc/stdenv/stdenv.xml b/doc/stdenv/stdenv.xml
index 46ee97927eac..282893b0ca2b 100644
--- a/doc/stdenv/stdenv.xml
+++ b/doc/stdenv/stdenv.xml
@@ -1989,7 +1989,7 @@ addEnvHooks "$hostOffset" myBashFunction
</term>
<listitem>
<para>
- Exports <envar>GDK_PIXBUF_MODULE_FILE</envar> environment variable to the builder. Add librsvg package to <varname>buildInputs</varname> to get svg support.
+ Exports <envar>GDK_PIXBUF_MODULE_FILE</envar> environment variable to the builder. Add librsvg package to <varname>buildInputs</varname> to get svg support. See also <xref linkend="ssec-gnome-hooks-gdk-pixbuf" />.
</para>
</listitem>
</varlistentry>
diff --git a/doc/using/configuration.xml b/doc/using/configuration.xml
index 3e21b0e22843..336bdf5b2656 100644
--- a/doc/using/configuration.xml
+++ b/doc/using/configuration.xml
@@ -169,6 +169,9 @@
}
</programlisting>
</para>
+ <para>
+ Note that <literal>whitelistedLicenses</literal> only applies to unfree licenses unless <literal>allowUnfree</literal> is enabled. It is not a generic whitelist for all types of licenses. <literal>blacklistedLicenses</literal> applies to all licenses.
+ </para>
</listitem>
</itemizedlist>
diff --git a/doc/using/overlays.xml b/doc/using/overlays.xml
index 4937e9508857..caacb0a04622 100644
--- a/doc/using/overlays.xml
+++ b/doc/using/overlays.xml
@@ -28,6 +28,7 @@
</para>
<para>
+ NOTE: DO NOT USE THIS in nixpkgs.
Further overlays can be added by calling the <literal>pkgs.extend</literal> or <literal>pkgs.appendOverlays</literal>, although it is often preferable to avoid these functions, because they recompute the Nixpkgs fixpoint, which is somewhat expensive to do.
</para>
</section>