From 95dfbe2d632b71a72634d2d65e3f738f500ee5ce Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 20 Oct 2019 12:17:58 +0200 Subject: [PATCH 1/7] doc: organize chapters into parts, and reduce toc depth Reorganize the chapters into parts and reduce the TOC depth to make the TOC useful again. The top-level TOC is very brief, but that is fine because every part will have its own TOC. Section titles of languages/frameworks are also simplified to just the name of the language/framework. --- ....xml => contributing-to-documentation.xml} | 0 doc/doc-support/parameters.xml | 2 +- .../emscripten.section.md | 2 +- doc/languages-frameworks/haskell.section.md | 2 +- doc/languages-frameworks/idris.section.md | 2 +- doc/languages-frameworks/index.xml | 2 +- doc/languages-frameworks/node.section.md | 4 +- doc/languages-frameworks/r.section.md | 4 +- doc/languages-frameworks/rust.section.md | 2 +- doc/languages-frameworks/vim.section.md | 2 +- doc/manual.xml | 44 ++++++++++++------- doc/platform-notes.xml | 2 +- doc/reviewing-contributions.xml | 2 +- 13 files changed, 41 insertions(+), 29 deletions(-) rename doc/{contributing.xml => contributing-to-documentation.xml} (100%) diff --git a/doc/contributing.xml b/doc/contributing-to-documentation.xml similarity index 100% rename from doc/contributing.xml rename to doc/contributing-to-documentation.xml diff --git a/doc/doc-support/parameters.xml b/doc/doc-support/parameters.xml index bc13e2b70dec..e4b33e66ee4d 100644 --- a/doc/doc-support/parameters.xml +++ b/doc/doc-support/parameters.xml @@ -8,7 +8,7 @@ - + diff --git a/doc/languages-frameworks/emscripten.section.md b/doc/languages-frameworks/emscripten.section.md index 24c49ec1409c..80e1094809ad 100644 --- a/doc/languages-frameworks/emscripten.section.md +++ b/doc/languages-frameworks/emscripten.section.md @@ -1,4 +1,4 @@ -# User's Guide to Emscripten in Nixpkgs +# Emscripten [Emscripten](https://github.com/kripken/emscripten): An LLVM-to-JavaScript Compiler diff --git a/doc/languages-frameworks/haskell.section.md b/doc/languages-frameworks/haskell.section.md index 48d22831cd9b..1e677450aa19 100644 --- a/doc/languages-frameworks/haskell.section.md +++ b/doc/languages-frameworks/haskell.section.md @@ -3,7 +3,7 @@ title: User's Guide for Haskell in Nixpkgs author: Peter Simons date: 2015-06-01 --- -# User's Guide to the Haskell Infrastructure +# Haskell ## How to install Haskell packages diff --git a/doc/languages-frameworks/idris.section.md b/doc/languages-frameworks/idris.section.md index e88015f08e3f..8d7962d7fb9b 100644 --- a/doc/languages-frameworks/idris.section.md +++ b/doc/languages-frameworks/idris.section.md @@ -1,4 +1,4 @@ -# Idris packages +# Idris ## Installing Idris diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml index cd0b48adb14a..86076085799e 100644 --- a/doc/languages-frameworks/index.xml +++ b/doc/languages-frameworks/index.xml @@ -1,7 +1,7 @@ - Support for specific programming languages and frameworks + Languages and frameworks The standard build environment makes it easy to build typical Autotools-based packages with very little code. Any other kind of package can be accomodated by overriding the appropriate phases of stdenv. However, there are specialised functions in Nixpkgs to easily build packages for other programming languages, such as Perl or Haskell. These are described in this chapter. diff --git a/doc/languages-frameworks/node.section.md b/doc/languages-frameworks/node.section.md index c6dce04c7b8b..4dc95fc1dd98 100644 --- a/doc/languages-frameworks/node.section.md +++ b/doc/languages-frameworks/node.section.md @@ -1,5 +1,5 @@ -Node.js packages -================ +Node.js +======= The `pkgs/development/node-packages` folder contains a generated collection of [NPM packages](https://npmjs.com/) that can be installed with the Nix package manager. diff --git a/doc/languages-frameworks/r.section.md b/doc/languages-frameworks/r.section.md index c8f02bd14780..d4e1617779ce 100644 --- a/doc/languages-frameworks/r.section.md +++ b/doc/languages-frameworks/r.section.md @@ -1,5 +1,5 @@ -R packages -========== +R += ## Installation diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md index 83b7b159bd63..31f1abd197b5 100644 --- a/doc/languages-frameworks/rust.section.md +++ b/doc/languages-frameworks/rust.section.md @@ -4,7 +4,7 @@ author: Matthias Beyer date: 2017-03-05 --- -# User's Guide to the Rust Infrastructure +# Rust To install the rust compiler and cargo put diff --git a/doc/languages-frameworks/vim.section.md b/doc/languages-frameworks/vim.section.md index 537e7b93e523..05a23d26cf2f 100644 --- a/doc/languages-frameworks/vim.section.md +++ b/doc/languages-frameworks/vim.section.md @@ -3,7 +3,7 @@ title: User's Guide for Vim in Nixpkgs author: Marc Weber date: 2016-06-25 --- -# User's Guide to Vim Plugins/Addons/Bundles/Scripts in Nixpkgs +# Vim Both Neovim and Vim can be configured to include your favorite plugins and additional libraries. diff --git a/doc/manual.xml b/doc/manual.xml index ab845e1a1086..7015e18d1e97 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -6,20 +6,32 @@ - - - - - - - - - - - - - - - - + + Using Nixpkgs + + + + + + Standard environment + + + + + + + + Languages, frameworks and packages + + + + + + Contributing to Nixpkgs + + + + + + diff --git a/doc/platform-notes.xml b/doc/platform-notes.xml index d8d7692fc9a7..5a266fdc0eea 100644 --- a/doc/platform-notes.xml +++ b/doc/platform-notes.xml @@ -1,6 +1,6 @@ + xml:id="chap-platform-notes"> Platform Notes
Darwin (macOS) diff --git a/doc/reviewing-contributions.xml b/doc/reviewing-contributions.xml index 5a14684f9b1e..c6fb62567815 100644 --- a/doc/reviewing-contributions.xml +++ b/doc/reviewing-contributions.xml @@ -2,7 +2,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0" - xml:id="sec-reviewing-contributions"> + xml:id="chap-reviewing-contributions"> Reviewing contributions From 115018ff15528f51235a8ac45c4261b7bd6a8173 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 20 Oct 2019 12:37:45 +0200 Subject: [PATCH 2/7] doc: merge package notes and package-specific notes Maybe there was an idea behind this separation, but looking at the contents I don't see any reason for these being separate. --- doc/languages-frameworks/index.xml | 4 +- doc/manual.xml | 1 - doc/package-notes.xml | 351 +++++++++++++++++++++++++++ doc/package-specific-user-notes.xml | 357 ---------------------------- 4 files changed, 353 insertions(+), 360 deletions(-) delete mode 100644 doc/package-specific-user-notes.xml diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml index 86076085799e..9364c764bbf9 100644 --- a/doc/languages-frameworks/index.xml +++ b/doc/languages-frameworks/index.xml @@ -9,6 +9,8 @@ + + @@ -27,6 +29,4 @@ - - diff --git a/doc/manual.xml b/doc/manual.xml index 7015e18d1e97..1083af3cdd84 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -23,7 +23,6 @@ Languages, frameworks and packages - diff --git a/doc/package-notes.xml b/doc/package-notes.xml index 770b277cd909..84b7e232eab6 100644 --- a/doc/package-notes.xml +++ b/doc/package-notes.xml @@ -419,4 +419,355 @@ stdenv.mkDerivation {
+
+ OpenGL + + + Packages that use OpenGL have NixOS desktop as their primary target. The current solution for loading the GPU-specific drivers is based on libglvnd and looks for the driver implementation in LD_LIBRARY_PATH. 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 proprietary video drivers you might have luck with also adding the corresponding video driver package. + +
+
+ Locales + + + To allow simultaneous use of packages linked against different versions of glibc with different locale archive formats Nixpkgs patches glibc to rely on LOCALE_ARCHIVE environment variable. + + + + On non-NixOS distributions this variable is obviously not set. This can cause regressions in language support or even crashes in some Nixpkgs-provided programs. The simplest way to mitigate this problem is exporting the LOCALE_ARCHIVE variable pointing to ${glibcLocales}/lib/locale/locale-archive. The drawback (and the reason this is not the default) is the relatively large (a hundred MiB) size of the full set of locales. It is possible to build a custom set of locales by overriding parameters allLocales and locales of the package. + +
+
+ Emacs + +
+ Configuring Emacs + + + 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: + + + +{ + 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. + + + +{ + 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'. + + + +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 +]) + +
+
+
+ DLib + + + DLib is a modern, C++-based toolkit which provides several machine learning algorithms. + + +
+ Compiling without AVX support + + + Especially older CPUs don't support AVX (Advanced Vector Extensions) instructions that are used by DLib to optimize their algorithms. + + + + On the affected hardware errors like Illegal instruction will occur. In those cases AVX support needs to be disabled: +self: super: { + dlib = super.dlib.override { avxSupport = false; }; +} + +
+
+
+ Unfree software + + + All users of Nixpkgs are free software users, and many users (and developers) of Nixpkgs want to limit and tightly control their exposure to unfree software. At the same time, many users need (or want) to run some specific pieces of proprietary software. Nixpkgs includes some expressions for unfree software packages. By default unfree software cannot be installed and doesn’t show up in searches. To allow installing unfree software in a single Nix invocation one can export NIXPKGS_ALLOW_UNFREE=1. For a persistent solution, users can set allowUnfree in the Nixpkgs configuration. + + + + Fine-grained control is possible by defining allowUnfreePredicate function in config; it takes the mkDerivation parameter attrset and returns true for unfree packages that should be allowed. + +
+
+ Steam + +
+ Steam in Nix + + + Steam is distributed as a .deb file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called steam that in Ubuntu (their target distro) would go to /usr/bin . When run for the first time, this script copies some files to the user's home, which include another script that is the ultimate responsible for launching the steam binary, which is also in $HOME. + + + + Nix problems and constraints: + + + + We don't have /bin/bash and many scripts point there. Similarly for /usr/bin/python . + + + + + We don't have the dynamic loader in /lib . + + + + + The steam.sh script in $HOME can not be patched, as it is checked and rewritten by steam. + + + + + The steam binary cannot be patched, it's also checked. + + + + + + + The current approach to deploy Steam in NixOS is composing a FHS-compatible chroot environment, as documented here. This allows us to have binaries in the expected paths without disrupting the system, and to avoid patching them to work in a non FHS environment. + +
+ +
+ How to play + + + For 64-bit systems it's important to have +hardware.opengl.driSupport32Bit = true; + in your /etc/nixos/configuration.nix. You'll also need +hardware.pulseaudio.support32Bit = true; + if you are using PulseAudio - this will enable 32bit ALSA apps integration. To use the Steam controller or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pro, you need to add +hardware.steam-hardware.enable = true; + to your configuration. + +
+ +
+ Troubleshooting + + + + + + Steam fails to start. What do I do? + + + + Try to run +strace steam + to see what is causing steam to fail. + + + + + + Using the FOSS Radeon or nouveau (nvidia) drivers + + + + + + The newStdcpp parameter was removed since NixOS 17.09 and should not be needed anymore. + + + + + Steam ships statically linked with a version of libcrypto that conflics with the one dynamically loaded by radeonsi_dri.so. If you get the error +steam.sh: line 713: 7842 Segmentation fault (core dumped) + have a look at this pull request. + + + + + + + + Java + + + + + + There is no java in steam chrootenv by default. If you get a message like +/home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found + You need to add + steam.override { withJava = true; }; + to your configuration. + + + + + + + +
+ +
+ steam-run + + + The FHS-compatible chroot used for steam can also be used to run other linux games that expect a FHS environment. To do it, add +pkgs.(steam.override { + nativeOnly = true; + newStdcpp = true; + }).run + to your configuration, rebuild, and run the game with +steam-run ./foo + +
+
+
+ Citrix Receiver & Citrix Workspace App + + + + + Please note that the citrix_receiver package has been deprecated since its development was discontinued by upstream and has been replaced by the citrix workspace app. + + + Citrix Receiver and Citrix Workspace App are a remote desktop viewers which provide access to XenDesktop installations. + + +
+ Basic usage + + + The tarball archive needs to be downloaded manually as the license agreements of the vendor for Citrix Receiver or Citrix Workspace need to be accepted first. Then run nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz. With the archive available in the store the package can be built and installed with Nix. + + + + Caution with <command>nix-shell</command> installs + + It's recommended to install Citrix Receiver and/or Citrix Workspace using nix-env -i or globally to ensure that the .desktop files are installed properly into $XDG_CONFIG_DIRS. Otherwise it won't be possible to open .ica files automatically from the browser to start a Citrix connection. + + +
+ +
+ Custom certificates + + + The Citrix Workspace App in nixpkgs trust several certificates from the Mozilla database by default. However several companies using Citrix might require their own corporate certificate. On distros with imperative packaging these certs can be stored easily in $ICAROOT, however this directory is a store path in nixpkgs. In order to work around this issue the package provides a simple mechanism to add custom certificates without rebuilding the entire package using symlinkJoin: + + { config.allowUnfree = true; }; +let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in +citrix_workspace.override { + inherit extraCerts; +}]]> + + +
+
diff --git a/doc/package-specific-user-notes.xml b/doc/package-specific-user-notes.xml deleted file mode 100644 index a3ee42dc7fa0..000000000000 --- a/doc/package-specific-user-notes.xml +++ /dev/null @@ -1,357 +0,0 @@ - - Package-specific usage notes - - These chapters includes some notes that apply to specific packages and should answer some of the frequently asked questions related to Nixpkgs use. Some useful information related to package use can be found in package-specific development notes. - -
- OpenGL - - - Packages that use OpenGL have NixOS desktop as their primary target. The current solution for loading the GPU-specific drivers is based on libglvnd and looks for the driver implementation in LD_LIBRARY_PATH. 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 proprietary video drivers you might have luck with also adding the corresponding video driver package. - -
-
- Locales - - - To allow simultaneous use of packages linked against different versions of glibc with different locale archive formats Nixpkgs patches glibc to rely on LOCALE_ARCHIVE environment variable. - - - - On non-NixOS distributions this variable is obviously not set. This can cause regressions in language support or even crashes in some Nixpkgs-provided programs. The simplest way to mitigate this problem is exporting the LOCALE_ARCHIVE variable pointing to ${glibcLocales}/lib/locale/locale-archive. The drawback (and the reason this is not the default) is the relatively large (a hundred MiB) size of the full set of locales. It is possible to build a custom set of locales by overriding parameters allLocales and locales of the package. - -
-
- Emacs - -
- Configuring Emacs - - - 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: - - - -{ - 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. - - - -{ - 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'. - - - -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 -]) - -
-
-
- DLib - - - DLib is a modern, C++-based toolkit which provides several machine learning algorithms. - - -
- Compiling without AVX support - - - Especially older CPUs don't support AVX (Advanced Vector Extensions) instructions that are used by DLib to optimize their algorithms. - - - - On the affected hardware errors like Illegal instruction will occur. In those cases AVX support needs to be disabled: -self: super: { - dlib = super.dlib.override { avxSupport = false; }; -} - -
-
-
- Unfree software - - - All users of Nixpkgs are free software users, and many users (and developers) of Nixpkgs want to limit and tightly control their exposure to unfree software. At the same time, many users need (or want) to run some specific pieces of proprietary software. Nixpkgs includes some expressions for unfree software packages. By default unfree software cannot be installed and doesn’t show up in searches. To allow installing unfree software in a single Nix invocation one can export NIXPKGS_ALLOW_UNFREE=1. For a persistent solution, users can set allowUnfree in the Nixpkgs configuration. - - - - Fine-grained control is possible by defining allowUnfreePredicate function in config; it takes the mkDerivation parameter attrset and returns true for unfree packages that should be allowed. - -
-
- Steam - -
- Steam in Nix - - - Steam is distributed as a .deb file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called steam that in Ubuntu (their target distro) would go to /usr/bin . When run for the first time, this script copies some files to the user's home, which include another script that is the ultimate responsible for launching the steam binary, which is also in $HOME. - - - - Nix problems and constraints: - - - - We don't have /bin/bash and many scripts point there. Similarly for /usr/bin/python . - - - - - We don't have the dynamic loader in /lib . - - - - - The steam.sh script in $HOME can not be patched, as it is checked and rewritten by steam. - - - - - The steam binary cannot be patched, it's also checked. - - - - - - - The current approach to deploy Steam in NixOS is composing a FHS-compatible chroot environment, as documented here. This allows us to have binaries in the expected paths without disrupting the system, and to avoid patching them to work in a non FHS environment. - -
- -
- How to play - - - For 64-bit systems it's important to have -hardware.opengl.driSupport32Bit = true; - in your /etc/nixos/configuration.nix. You'll also need -hardware.pulseaudio.support32Bit = true; - if you are using PulseAudio - this will enable 32bit ALSA apps integration. To use the Steam controller or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pro, you need to add -hardware.steam-hardware.enable = true; - to your configuration. - -
- -
- Troubleshooting - - - - - - Steam fails to start. What do I do? - - - - Try to run -strace steam - to see what is causing steam to fail. - - - - - - Using the FOSS Radeon or nouveau (nvidia) drivers - - - - - - The newStdcpp parameter was removed since NixOS 17.09 and should not be needed anymore. - - - - - Steam ships statically linked with a version of libcrypto that conflics with the one dynamically loaded by radeonsi_dri.so. If you get the error -steam.sh: line 713: 7842 Segmentation fault (core dumped) - have a look at this pull request. - - - - - - - - Java - - - - - - There is no java in steam chrootenv by default. If you get a message like -/home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found - You need to add - steam.override { withJava = true; }; - to your configuration. - - - - - - - -
- -
- steam-run - - - The FHS-compatible chroot used for steam can also be used to run other linux games that expect a FHS environment. To do it, add -pkgs.(steam.override { - nativeOnly = true; - newStdcpp = true; - }).run - to your configuration, rebuild, and run the game with -steam-run ./foo - -
-
-
- Citrix Receiver & Citrix Workspace App - - - - - Please note that the citrix_receiver package has been deprecated since its development was discontinued by upstream and has been replaced by the citrix workspace app. - - - Citrix Receiver and Citrix Workspace App are a remote desktop viewers which provide access to XenDesktop installations. - - -
- Basic usage - - - The tarball archive needs to be downloaded manually as the license agreements of the vendor for Citrix Receiver or Citrix Workspace need to be accepted first. Then run nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz. With the archive available in the store the package can be built and installed with Nix. - - - - Caution with <command>nix-shell</command> installs - - It's recommended to install Citrix Receiver and/or Citrix Workspace using nix-env -i or globally to ensure that the .desktop files are installed properly into $XDG_CONFIG_DIRS. Otherwise it won't be possible to open .ica files automatically from the browser to start a Citrix connection. - - -
- -
- Custom certificates - - - The Citrix Workspace App in nixpkgs trust several certificates from the Mozilla database by default. However several companies using Citrix might require their own corporate certificate. On distros with imperative packaging these certs can be stored easily in $ICAROOT, however this directory is a store path in nixpkgs. In order to work around this issue the package provides a simple mechanism to add custom certificates without rebuilding the entire package using symlinkJoin: - - { config.allowUnfree = true; }; -let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in -citrix_workspace.override { - inherit extraCerts; -}]]> - - -
-
-
From efb55d2a42e1b047c65b1d125cc955df84f8e0af Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 20 Oct 2019 13:14:30 +0200 Subject: [PATCH 3/7] doc: split packages part into xml file per package --- doc/manual.xml | 2 +- doc/package-notes.xml | 773 --------------------------------- doc/packages/citrix.xml | 44 ++ doc/packages/dlib.xml | 24 + doc/packages/eclipse.xml | 72 +++ doc/packages/elm.xml | 17 + doc/packages/emacs.xml | 131 ++++++ doc/packages/ibus.xml | 57 +++ doc/packages/index.xml | 23 + doc/packages/kakoune.xml | 14 + doc/packages/linux.xml | 85 ++++ doc/packages/locales.xml | 13 + doc/packages/nginx.xml | 25 ++ doc/packages/opengl.xml | 9 + doc/packages/shell-helpers.xml | 25 ++ doc/packages/steam.xml | 131 ++++++ doc/packages/unfree.xml | 13 + doc/packages/weechat.xml | 85 ++++ doc/packages/xorg.xml | 34 ++ 19 files changed, 803 insertions(+), 774 deletions(-) delete mode 100644 doc/package-notes.xml create mode 100644 doc/packages/citrix.xml create mode 100644 doc/packages/dlib.xml create mode 100644 doc/packages/eclipse.xml create mode 100644 doc/packages/elm.xml create mode 100644 doc/packages/emacs.xml create mode 100644 doc/packages/ibus.xml create mode 100644 doc/packages/index.xml create mode 100644 doc/packages/kakoune.xml create mode 100644 doc/packages/linux.xml create mode 100644 doc/packages/locales.xml create mode 100644 doc/packages/nginx.xml create mode 100644 doc/packages/opengl.xml create mode 100644 doc/packages/shell-helpers.xml create mode 100644 doc/packages/steam.xml create mode 100644 doc/packages/unfree.xml create mode 100644 doc/packages/weechat.xml create mode 100644 doc/packages/xorg.xml diff --git a/doc/manual.xml b/doc/manual.xml index 1083af3cdd84..001a5f3eca53 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -23,7 +23,7 @@ Languages, frameworks and packages - + Contributing to Nixpkgs diff --git a/doc/package-notes.xml b/doc/package-notes.xml deleted file mode 100644 index 84b7e232eab6..000000000000 --- a/doc/package-notes.xml +++ /dev/null @@ -1,773 +0,0 @@ - - Package Notes - - This chapter contains information about how to use and maintain the Nix expressions for a number of specific packages, such as the Linux kernel or X.org. - - -
- Linux kernel - - - The Nix expressions to build the Linux kernel are in 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: - -modulesTree = [kernel] - ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi - ++ ...; - - - - - How to add a new (major) version of the Linux kernel to Nixpkgs: - - - - 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. - - - - - Add the new kernel to all-packages.nix (e.g., create an attribute kernel_2_6_22). - - - - - 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: - - - - 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). - - - - - Copy the config file for this platform (e.g. config-2.6.22-i686-smp) to .config in the kernel source tree. - - - - - 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). - - - - - If needed you can also run make menuconfig: - -$ nix-env -i ncurses -$ export NIX_CFLAGS_LINK=-lncurses -$ make menuconfig ARCH=arch - - - - - Copy .config over the new config file (e.g. config-2.6.22-i686-smp). - - - - - - - - Test building the kernel: nix-build -A kernel_2_6_22. If it compiles, ship it! For extra credit, try booting NixOS with it. - - - - - 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. - - - - -
- -
- X.org - - - 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. - - - - The generator is invoked as follows: - -$ cd pkgs/servers/x11/xorg -$ cat tarballs-7.5.list extra.list old.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.) - - - - A file like tarballs-7.5.list contains all tarballs in a X.org release. It can be generated like this: - -$ export i="mirror://xorg/X11R7.4/src/everything/" -$ cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \ - | perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'i'}$2\n"; }; }' \ - | sort > tarballs-7.4.list - - extra.list contains libraries that aren’t part of X.org proper, but are closely related to it, such as libxcb. old.list contains some packages that were removed from X.org, but are still needed by some people or by other packages (such as imake). - - - - 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. - -
- - - - - -
- Eclipse - - - The Nix expressions related to the Eclipse platform and IDE are in pkgs/applications/editors/eclipse. - - - - Nixpkgs provides a number of packages that will install Eclipse in its various forms. These range from the bare-bones Eclipse Platform to the more fully featured Eclipse SDK or Scala-IDE packages and multiple version are often available. It is possible to list available Eclipse packages by issuing the command: - -$ nix-env -f '<nixpkgs>' -qaP -A eclipses --description - - Once an Eclipse variant is installed it can be run using the eclipse command, as expected. From within Eclipse it is then possible to install plugins in the usual manner by either manually specifying an Eclipse update site or by installing the Marketplace Client plugin and using it to discover and install other plugins. This installation method provides an Eclipse installation that closely resemble a manually installed Eclipse. - - - - If you prefer to install plugins in a more declarative manner then Nixpkgs also offer a number of Eclipse plugins that can be installed in an Eclipse environment. This type of environment is created using the function eclipseWithPlugins found inside the nixpkgs.eclipses attribute set. This function takes as argument { eclipse, plugins ? [], jvmArgs ? [] } where eclipse is a one of the Eclipse packages described above, plugins is a list of plugin derivations, and jvmArgs is a list of arguments given to the JVM running the Eclipse. For example, say you wish to install the latest Eclipse Platform with the popular Eclipse Color Theme plugin and also allow Eclipse to use more RAM. You could then add - -packageOverrides = pkgs: { - myEclipse = with pkgs.eclipses; eclipseWithPlugins { - eclipse = eclipse-platform; - jvmArgs = [ "-Xmx2048m" ]; - plugins = [ plugins.color-theme ]; - }; -} - - to your Nixpkgs configuration (~/.config/nixpkgs/config.nix) and install it by running nix-env -f '<nixpkgs>' -iA myEclipse and afterward run Eclipse as usual. It is possible to find out which plugins are available for installation using eclipseWithPlugins by running - -$ nix-env -f '<nixpkgs>' -qaP -A eclipses.plugins --description - - - - - If there is a need to install plugins that are not available in Nixpkgs then it may be possible to define these plugins outside Nixpkgs using the buildEclipseUpdateSite and buildEclipsePlugin functions found in the nixpkgs.eclipses.plugins attribute set. Use the buildEclipseUpdateSite function to install a plugin distributed as an Eclipse update site. This function takes { name, src } as argument where src indicates the Eclipse update site archive. All Eclipse features and plugins within the downloaded update site will be installed. When an update site archive is not available then the buildEclipsePlugin function can be used to install a plugin that consists of a pair of feature and plugin JARs. This function takes an argument { name, srcFeature, srcPlugin } where srcFeature and srcPlugin are the feature and plugin JARs, respectively. - - - - Expanding the previous example with two plugins using the above functions we have - -packageOverrides = pkgs: { - myEclipse = with pkgs.eclipses; eclipseWithPlugins { - eclipse = eclipse-platform; - jvmArgs = [ "-Xmx2048m" ]; - plugins = [ - plugins.color-theme - (plugins.buildEclipsePlugin { - name = "myplugin1-1.0"; - srcFeature = fetchurl { - url = "http://…/features/myplugin1.jar"; - sha256 = "123…"; - }; - srcPlugin = fetchurl { - url = "http://…/plugins/myplugin1.jar"; - sha256 = "123…"; - }; - }); - (plugins.buildEclipseUpdateSite { - name = "myplugin2-1.0"; - src = fetchurl { - stripRoot = false; - url = "http://…/myplugin2.zip"; - sha256 = "123…"; - }; - }); - ]; - }; -} - - -
-
- Elm - - - To start a development environment do nix-shell -p elmPackages.elm elmPackages.elm-format - - - - To update Elm compiler, see nixpkgs/pkgs/development/compilers/elm/README.md. - - - - To package Elm applications, read about elm2nix. - -
-
- Kakoune - - - Kakoune can be built to autoload plugins: -(kakoune.override { - configure = { - plugins = with pkgs.kakounePlugins; [ parinfer-rust ]; - }; -}) - -
-
- Interactive 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: - - - - autojump: autojump-share - - - - - fzf: fzf-share - - - - E.g. autojump can then used in the .bashrc like this: - - source "$(autojump-share)/autojump.bash" - - -
-
- 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 -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: -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: -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: -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: -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: -{ 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 - ''; -} - -
-
- ibus-engines.typing-booster - - - This package is an ibus-based completion method to speed up typing. - - -
- Activating the engine - - - IBus needs to be configured accordingly to activate typing-booster. The configuration depends on the desktop manager in use. For detailed instructions, please refer to the upstream docs. - - - - On NixOS you need to explicitly enable ibus with given engines before customizing your desktop to use typing-booster. This can be achieved using the ibus module: -{ pkgs, ... }: { - i18n.inputMethod = { - enabled = "ibus"; - ibus.engines = with pkgs.ibus-engines; [ typing-booster ]; - }; -} - -
- -
- Using custom hunspell dictionaries - - - The IBus engine is based on hunspell to support completion in many languages. By default the dictionaries de-de, en-us, fr-moderne es-es, it-it, sv-se and sv-fi are in use. To add another dictionary, the package can be overridden like this: -ibus-engines.typing-booster.override { - langs = [ "de-at" "en-gb" ]; -} - - - - Note: each language passed to langs must be an attribute name in pkgs.hunspellDicts. - -
- -
- Built-in emoji picker - - - The ibus-engines.typing-booster package contains a program named emoji-picker. To display all emojis correctly, a special font such as noto-fonts-emoji is needed: - - - - On NixOS it can be installed using the following expression: -{ pkgs, ... }: { - fonts.fonts = with pkgs; [ noto-fonts-emoji ]; -} - -
-
-
- Nginx - - - Nginx is a reverse proxy and lightweight webserver. - - -
- ETags on static files served from the Nix store - - - 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 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 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. - -
-
-
- OpenGL - - - Packages that use OpenGL have NixOS desktop as their primary target. The current solution for loading the GPU-specific drivers is based on libglvnd and looks for the driver implementation in LD_LIBRARY_PATH. 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 proprietary video drivers you might have luck with also adding the corresponding video driver package. - -
-
- Locales - - - To allow simultaneous use of packages linked against different versions of glibc with different locale archive formats Nixpkgs patches glibc to rely on LOCALE_ARCHIVE environment variable. - - - - On non-NixOS distributions this variable is obviously not set. This can cause regressions in language support or even crashes in some Nixpkgs-provided programs. The simplest way to mitigate this problem is exporting the LOCALE_ARCHIVE variable pointing to ${glibcLocales}/lib/locale/locale-archive. The drawback (and the reason this is not the default) is the relatively large (a hundred MiB) size of the full set of locales. It is possible to build a custom set of locales by overriding parameters allLocales and locales of the package. - -
-
- Emacs - -
- Configuring Emacs - - - 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: - - - -{ - 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. - - - -{ - 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'. - - - -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 -]) - -
-
-
- DLib - - - DLib is a modern, C++-based toolkit which provides several machine learning algorithms. - - -
- Compiling without AVX support - - - Especially older CPUs don't support AVX (Advanced Vector Extensions) instructions that are used by DLib to optimize their algorithms. - - - - On the affected hardware errors like Illegal instruction will occur. In those cases AVX support needs to be disabled: -self: super: { - dlib = super.dlib.override { avxSupport = false; }; -} - -
-
-
- Unfree software - - - All users of Nixpkgs are free software users, and many users (and developers) of Nixpkgs want to limit and tightly control their exposure to unfree software. At the same time, many users need (or want) to run some specific pieces of proprietary software. Nixpkgs includes some expressions for unfree software packages. By default unfree software cannot be installed and doesn’t show up in searches. To allow installing unfree software in a single Nix invocation one can export NIXPKGS_ALLOW_UNFREE=1. For a persistent solution, users can set allowUnfree in the Nixpkgs configuration. - - - - Fine-grained control is possible by defining allowUnfreePredicate function in config; it takes the mkDerivation parameter attrset and returns true for unfree packages that should be allowed. - -
-
- Steam - -
- Steam in Nix - - - Steam is distributed as a .deb file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called steam that in Ubuntu (their target distro) would go to /usr/bin . When run for the first time, this script copies some files to the user's home, which include another script that is the ultimate responsible for launching the steam binary, which is also in $HOME. - - - - Nix problems and constraints: - - - - We don't have /bin/bash and many scripts point there. Similarly for /usr/bin/python . - - - - - We don't have the dynamic loader in /lib . - - - - - The steam.sh script in $HOME can not be patched, as it is checked and rewritten by steam. - - - - - The steam binary cannot be patched, it's also checked. - - - - - - - The current approach to deploy Steam in NixOS is composing a FHS-compatible chroot environment, as documented here. This allows us to have binaries in the expected paths without disrupting the system, and to avoid patching them to work in a non FHS environment. - -
- -
- How to play - - - For 64-bit systems it's important to have -hardware.opengl.driSupport32Bit = true; - in your /etc/nixos/configuration.nix. You'll also need -hardware.pulseaudio.support32Bit = true; - if you are using PulseAudio - this will enable 32bit ALSA apps integration. To use the Steam controller or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pro, you need to add -hardware.steam-hardware.enable = true; - to your configuration. - -
- -
- Troubleshooting - - - - - - Steam fails to start. What do I do? - - - - Try to run -strace steam - to see what is causing steam to fail. - - - - - - Using the FOSS Radeon or nouveau (nvidia) drivers - - - - - - The newStdcpp parameter was removed since NixOS 17.09 and should not be needed anymore. - - - - - Steam ships statically linked with a version of libcrypto that conflics with the one dynamically loaded by radeonsi_dri.so. If you get the error -steam.sh: line 713: 7842 Segmentation fault (core dumped) - have a look at this pull request. - - - - - - - - Java - - - - - - There is no java in steam chrootenv by default. If you get a message like -/home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found - You need to add - steam.override { withJava = true; }; - to your configuration. - - - - - - - -
- -
- steam-run - - - The FHS-compatible chroot used for steam can also be used to run other linux games that expect a FHS environment. To do it, add -pkgs.(steam.override { - nativeOnly = true; - newStdcpp = true; - }).run - to your configuration, rebuild, and run the game with -steam-run ./foo - -
-
-
- Citrix Receiver & Citrix Workspace App - - - - - Please note that the citrix_receiver package has been deprecated since its development was discontinued by upstream and has been replaced by the citrix workspace app. - - - Citrix Receiver and Citrix Workspace App are a remote desktop viewers which provide access to XenDesktop installations. - - -
- Basic usage - - - The tarball archive needs to be downloaded manually as the license agreements of the vendor for Citrix Receiver or Citrix Workspace need to be accepted first. Then run nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz. With the archive available in the store the package can be built and installed with Nix. - - - - Caution with <command>nix-shell</command> installs - - It's recommended to install Citrix Receiver and/or Citrix Workspace using nix-env -i or globally to ensure that the .desktop files are installed properly into $XDG_CONFIG_DIRS. Otherwise it won't be possible to open .ica files automatically from the browser to start a Citrix connection. - - -
- -
- Custom certificates - - - The Citrix Workspace App in nixpkgs trust several certificates from the Mozilla database by default. However several companies using Citrix might require their own corporate certificate. On distros with imperative packaging these certs can be stored easily in $ICAROOT, however this directory is a store path in nixpkgs. In order to work around this issue the package provides a simple mechanism to add custom certificates without rebuilding the entire package using symlinkJoin: - - { config.allowUnfree = true; }; -let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in -citrix_workspace.override { - inherit extraCerts; -}]]> - - -
-
-
diff --git a/doc/packages/citrix.xml b/doc/packages/citrix.xml new file mode 100644 index 000000000000..bc685f97932d --- /dev/null +++ b/doc/packages/citrix.xml @@ -0,0 +1,44 @@ +
+ Citrix Workspace + + + + + Please note that the citrix_receiver package has been deprecated since its development was discontinued by upstream and has been replaced by the citrix workspace app. + + + Citrix Receiver and Citrix Workspace App are a remote desktop viewers which provide access to XenDesktop installations. + + +
+ Basic usage + + + The tarball archive needs to be downloaded manually as the license agreements of the vendor for Citrix Receiver or Citrix Workspace need to be accepted first. Then run nix-prefetch-url file://$PWD/linuxx64-$version.tar.gz. With the archive available in the store the package can be built and installed with Nix. + + + + Caution with <command>nix-shell</command> installs + + It's recommended to install Citrix Receiver and/or Citrix Workspace using nix-env -i or globally to ensure that the .desktop files are installed properly into $XDG_CONFIG_DIRS. Otherwise it won't be possible to open .ica files automatically from the browser to start a Citrix connection. + + +
+ +
+ Custom certificates + + + The Citrix Workspace App in nixpkgs trust several certificates from the Mozilla database by default. However several companies using Citrix might require their own corporate certificate. On distros with imperative packaging these certs can be stored easily in $ICAROOT, however this directory is a store path in nixpkgs. In order to work around this issue the package provides a simple mechanism to add custom certificates without rebuilding the entire package using symlinkJoin: + + { config.allowUnfree = true; }; +let extraCerts = [ ./custom-cert-1.pem ./custom-cert-2.pem /* ... */ ]; in +citrix_workspace.override { + inherit extraCerts; +}]]> + + +
+
\ No newline at end of file diff --git a/doc/packages/dlib.xml b/doc/packages/dlib.xml new file mode 100644 index 000000000000..98c211cf9df7 --- /dev/null +++ b/doc/packages/dlib.xml @@ -0,0 +1,24 @@ +
+ DLib + + + DLib is a modern, C++-based toolkit which provides several machine learning algorithms. + + +
+ Compiling without AVX support + + + Especially older CPUs don't support AVX (Advanced Vector Extensions) instructions that are used by DLib to optimize their algorithms. + + + + On the affected hardware errors like Illegal instruction will occur. In those cases AVX support needs to be disabled: +self: super: { + dlib = super.dlib.override { avxSupport = false; }; +} + +
+
\ No newline at end of file diff --git a/doc/packages/eclipse.xml b/doc/packages/eclipse.xml new file mode 100644 index 000000000000..968c58d3b5bb --- /dev/null +++ b/doc/packages/eclipse.xml @@ -0,0 +1,72 @@ +
+ Eclipse + + + The Nix expressions related to the Eclipse platform and IDE are in pkgs/applications/editors/eclipse. + + + + Nixpkgs provides a number of packages that will install Eclipse in its various forms. These range from the bare-bones Eclipse Platform to the more fully featured Eclipse SDK or Scala-IDE packages and multiple version are often available. It is possible to list available Eclipse packages by issuing the command: + +$ nix-env -f '<nixpkgs>' -qaP -A eclipses --description + + Once an Eclipse variant is installed it can be run using the eclipse command, as expected. From within Eclipse it is then possible to install plugins in the usual manner by either manually specifying an Eclipse update site or by installing the Marketplace Client plugin and using it to discover and install other plugins. This installation method provides an Eclipse installation that closely resemble a manually installed Eclipse. + + + + If you prefer to install plugins in a more declarative manner then Nixpkgs also offer a number of Eclipse plugins that can be installed in an Eclipse environment. This type of environment is created using the function eclipseWithPlugins found inside the nixpkgs.eclipses attribute set. This function takes as argument { eclipse, plugins ? [], jvmArgs ? [] } where eclipse is a one of the Eclipse packages described above, plugins is a list of plugin derivations, and jvmArgs is a list of arguments given to the JVM running the Eclipse. For example, say you wish to install the latest Eclipse Platform with the popular Eclipse Color Theme plugin and also allow Eclipse to use more RAM. You could then add + +packageOverrides = pkgs: { + myEclipse = with pkgs.eclipses; eclipseWithPlugins { + eclipse = eclipse-platform; + jvmArgs = [ "-Xmx2048m" ]; + plugins = [ plugins.color-theme ]; + }; +} + + to your Nixpkgs configuration (~/.config/nixpkgs/config.nix) and install it by running nix-env -f '<nixpkgs>' -iA myEclipse and afterward run Eclipse as usual. It is possible to find out which plugins are available for installation using eclipseWithPlugins by running + +$ nix-env -f '<nixpkgs>' -qaP -A eclipses.plugins --description + + + + + If there is a need to install plugins that are not available in Nixpkgs then it may be possible to define these plugins outside Nixpkgs using the buildEclipseUpdateSite and buildEclipsePlugin functions found in the nixpkgs.eclipses.plugins attribute set. Use the buildEclipseUpdateSite function to install a plugin distributed as an Eclipse update site. This function takes { name, src } as argument where src indicates the Eclipse update site archive. All Eclipse features and plugins within the downloaded update site will be installed. When an update site archive is not available then the buildEclipsePlugin function can be used to install a plugin that consists of a pair of feature and plugin JARs. This function takes an argument { name, srcFeature, srcPlugin } where srcFeature and srcPlugin are the feature and plugin JARs, respectively. + + + + Expanding the previous example with two plugins using the above functions we have + +packageOverrides = pkgs: { + myEclipse = with pkgs.eclipses; eclipseWithPlugins { + eclipse = eclipse-platform; + jvmArgs = [ "-Xmx2048m" ]; + plugins = [ + plugins.color-theme + (plugins.buildEclipsePlugin { + name = "myplugin1-1.0"; + srcFeature = fetchurl { + url = "http://…/features/myplugin1.jar"; + sha256 = "123…"; + }; + srcPlugin = fetchurl { + url = "http://…/plugins/myplugin1.jar"; + sha256 = "123…"; + }; + }); + (plugins.buildEclipseUpdateSite { + name = "myplugin2-1.0"; + src = fetchurl { + stripRoot = false; + url = "http://…/myplugin2.zip"; + sha256 = "123…"; + }; + }); + ]; + }; +} + + +
\ No newline at end of file diff --git a/doc/packages/elm.xml b/doc/packages/elm.xml new file mode 100644 index 000000000000..8ee052852654 --- /dev/null +++ b/doc/packages/elm.xml @@ -0,0 +1,17 @@ +
+ Elm + + + To start a development environment do nix-shell -p elmPackages.elm elmPackages.elm-format + + + + To update Elm compiler, see nixpkgs/pkgs/development/compilers/elm/README.md. + + + + To package Elm applications, read about elm2nix. + +
\ No newline at end of file diff --git a/doc/packages/emacs.xml b/doc/packages/emacs.xml new file mode 100644 index 000000000000..a9a26882c9cd --- /dev/null +++ b/doc/packages/emacs.xml @@ -0,0 +1,131 @@ +
+ Emacs + +
+ Configuring Emacs + + + 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: + + + +{ + 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. + + + +{ + 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'. + + + +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 +]) + +
+
\ No newline at end of file diff --git a/doc/packages/ibus.xml b/doc/packages/ibus.xml new file mode 100644 index 000000000000..561d4d2eabdc --- /dev/null +++ b/doc/packages/ibus.xml @@ -0,0 +1,57 @@ +
+ ibus-engines.typing-booster + + + This package is an ibus-based completion method to speed up typing. + + +
+ Activating the engine + + + IBus needs to be configured accordingly to activate typing-booster. The configuration depends on the desktop manager in use. For detailed instructions, please refer to the upstream docs. + + + + On NixOS you need to explicitly enable ibus with given engines before customizing your desktop to use typing-booster. This can be achieved using the ibus module: +{ pkgs, ... }: { + i18n.inputMethod = { + enabled = "ibus"; + ibus.engines = with pkgs.ibus-engines; [ typing-booster ]; + }; +} + +
+ +
+ Using custom hunspell dictionaries + + + The IBus engine is based on hunspell to support completion in many languages. By default the dictionaries de-de, en-us, fr-moderne es-es, it-it, sv-se and sv-fi are in use. To add another dictionary, the package can be overridden like this: +ibus-engines.typing-booster.override { + langs = [ "de-at" "en-gb" ]; +} + + + + Note: each language passed to langs must be an attribute name in pkgs.hunspellDicts. + +
+ +
+ Built-in emoji picker + + + The ibus-engines.typing-booster package contains a program named emoji-picker. To display all emojis correctly, a special font such as noto-fonts-emoji is needed: + + + + On NixOS it can be installed using the following expression: +{ pkgs, ... }: { + fonts.fonts = with pkgs; [ noto-fonts-emoji ]; +} + +
+
\ No newline at end of file diff --git a/doc/packages/index.xml b/doc/packages/index.xml new file mode 100644 index 000000000000..9f3f58a8d903 --- /dev/null +++ b/doc/packages/index.xml @@ -0,0 +1,23 @@ + + Packages + + This chapter contains information about how to use and maintain the Nix expressions for a number of specific packages, such as the Linux kernel or X.org. + + + + + + + + + + + + + + + + + diff --git a/doc/packages/kakoune.xml b/doc/packages/kakoune.xml new file mode 100644 index 000000000000..fd40dad7ca87 --- /dev/null +++ b/doc/packages/kakoune.xml @@ -0,0 +1,14 @@ +
+ Kakoune + + + Kakoune can be built to autoload plugins: +(kakoune.override { + configure = { + plugins = with pkgs.kakounePlugins; [ parinfer-rust ]; + }; +}) + +
\ No newline at end of file diff --git a/doc/packages/linux.xml b/doc/packages/linux.xml new file mode 100644 index 000000000000..3adfacb6e457 --- /dev/null +++ b/doc/packages/linux.xml @@ -0,0 +1,85 @@ +
+ Linux kernel + + + The Nix expressions to build the Linux kernel are in 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: + +modulesTree = [kernel] + ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi + ++ ...; + + + + + How to add a new (major) version of the Linux kernel to Nixpkgs: + + + + 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. + + + + + Add the new kernel to all-packages.nix (e.g., create an attribute kernel_2_6_22). + + + + + 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: + + + + 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). + + + + + Copy the config file for this platform (e.g. config-2.6.22-i686-smp) to .config in the kernel source tree. + + + + + 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). + + + + + If needed you can also run make menuconfig: + +$ nix-env -i ncurses +$ export NIX_CFLAGS_LINK=-lncurses +$ make menuconfig ARCH=arch + + + + + Copy .config over the new config file (e.g. config-2.6.22-i686-smp). + + + + + + + + Test building the kernel: nix-build -A kernel_2_6_22. If it compiles, ship it! For extra credit, try booting NixOS with it. + + + + + 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. + + + + +
\ No newline at end of file diff --git a/doc/packages/locales.xml b/doc/packages/locales.xml new file mode 100644 index 000000000000..15954495e217 --- /dev/null +++ b/doc/packages/locales.xml @@ -0,0 +1,13 @@ +
+ Locales + + + To allow simultaneous use of packages linked against different versions of glibc with different locale archive formats Nixpkgs patches glibc to rely on LOCALE_ARCHIVE environment variable. + + + + On non-NixOS distributions this variable is obviously not set. This can cause regressions in language support or even crashes in some Nixpkgs-provided programs. The simplest way to mitigate this problem is exporting the LOCALE_ARCHIVE variable pointing to ${glibcLocales}/lib/locale/locale-archive. The drawback (and the reason this is not the default) is the relatively large (a hundred MiB) size of the full set of locales. It is possible to build a custom set of locales by overriding parameters allLocales and locales of the package. + +
\ No newline at end of file diff --git a/doc/packages/nginx.xml b/doc/packages/nginx.xml new file mode 100644 index 000000000000..921a6add2a0a --- /dev/null +++ b/doc/packages/nginx.xml @@ -0,0 +1,25 @@ +
+ Nginx + + + Nginx is a reverse proxy and lightweight webserver. + + +
+ ETags on static files served from the Nix store + + + 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 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 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. + +
+
\ No newline at end of file diff --git a/doc/packages/opengl.xml b/doc/packages/opengl.xml new file mode 100644 index 000000000000..fcb624736b09 --- /dev/null +++ b/doc/packages/opengl.xml @@ -0,0 +1,9 @@ +
+ OpenGL + + + Packages that use OpenGL have NixOS desktop as their primary target. The current solution for loading the GPU-specific drivers is based on libglvnd and looks for the driver implementation in LD_LIBRARY_PATH. 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 proprietary video drivers you might have luck with also adding the corresponding video driver package. + +
\ No newline at end of file diff --git a/doc/packages/shell-helpers.xml b/doc/packages/shell-helpers.xml new file mode 100644 index 000000000000..53416ce7e171 --- /dev/null +++ b/doc/packages/shell-helpers.xml @@ -0,0 +1,25 @@ +
+ Interactive 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: + + + + autojump: autojump-share + + + + + fzf: fzf-share + + + + E.g. autojump can then used in the .bashrc like this: + + source "$(autojump-share)/autojump.bash" + + +
\ No newline at end of file diff --git a/doc/packages/steam.xml b/doc/packages/steam.xml new file mode 100644 index 000000000000..413247ee4685 --- /dev/null +++ b/doc/packages/steam.xml @@ -0,0 +1,131 @@ +
+ Steam + +
+ Steam in Nix + + + Steam is distributed as a .deb file, for now only as an i686 package (the amd64 package only has documentation). When unpacked, it has a script called steam that in Ubuntu (their target distro) would go to /usr/bin . When run for the first time, this script copies some files to the user's home, which include another script that is the ultimate responsible for launching the steam binary, which is also in $HOME. + + + + Nix problems and constraints: + + + + We don't have /bin/bash and many scripts point there. Similarly for /usr/bin/python . + + + + + We don't have the dynamic loader in /lib . + + + + + The steam.sh script in $HOME can not be patched, as it is checked and rewritten by steam. + + + + + The steam binary cannot be patched, it's also checked. + + + + + + + The current approach to deploy Steam in NixOS is composing a FHS-compatible chroot environment, as documented here. This allows us to have binaries in the expected paths without disrupting the system, and to avoid patching them to work in a non FHS environment. + +
+ +
+ How to play + + + For 64-bit systems it's important to have +hardware.opengl.driSupport32Bit = true; + in your /etc/nixos/configuration.nix. You'll also need +hardware.pulseaudio.support32Bit = true; + if you are using PulseAudio - this will enable 32bit ALSA apps integration. To use the Steam controller or other Steam supported controllers such as the DualShock 4 or Nintendo Switch Pro, you need to add +hardware.steam-hardware.enable = true; + to your configuration. + +
+ +
+ Troubleshooting + + + + + + Steam fails to start. What do I do? + + + + Try to run +strace steam + to see what is causing steam to fail. + + + + + + Using the FOSS Radeon or nouveau (nvidia) drivers + + + + + + The newStdcpp parameter was removed since NixOS 17.09 and should not be needed anymore. + + + + + Steam ships statically linked with a version of libcrypto that conflics with the one dynamically loaded by radeonsi_dri.so. If you get the error +steam.sh: line 713: 7842 Segmentation fault (core dumped) + have a look at this pull request. + + + + + + + + Java + + + + + + There is no java in steam chrootenv by default. If you get a message like +/home/foo/.local/share/Steam/SteamApps/common/towns/towns.sh: line 1: java: command not found + You need to add + steam.override { withJava = true; }; + to your configuration. + + + + + + + +
+ +
+ steam-run + + + The FHS-compatible chroot used for steam can also be used to run other linux games that expect a FHS environment. To do it, add +pkgs.(steam.override { + nativeOnly = true; + newStdcpp = true; + }).run + to your configuration, rebuild, and run the game with +steam-run ./foo + +
+
\ No newline at end of file diff --git a/doc/packages/unfree.xml b/doc/packages/unfree.xml new file mode 100644 index 000000000000..b2d8402005e9 --- /dev/null +++ b/doc/packages/unfree.xml @@ -0,0 +1,13 @@ +
+ Unfree software + + + All users of Nixpkgs are free software users, and many users (and developers) of Nixpkgs want to limit and tightly control their exposure to unfree software. At the same time, many users need (or want) to run some specific pieces of proprietary software. Nixpkgs includes some expressions for unfree software packages. By default unfree software cannot be installed and doesn’t show up in searches. To allow installing unfree software in a single Nix invocation one can export NIXPKGS_ALLOW_UNFREE=1. For a persistent solution, users can set allowUnfree in the Nixpkgs configuration. + + + + Fine-grained control is possible by defining allowUnfreePredicate function in config; it takes the mkDerivation parameter attrset and returns true for unfree packages that should be allowed. + +
\ No newline at end of file diff --git a/doc/packages/weechat.xml b/doc/packages/weechat.xml new file mode 100644 index 000000000000..aeb240d904b5 --- /dev/null +++ b/doc/packages/weechat.xml @@ -0,0 +1,85 @@ +
+ 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 +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: +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: +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: +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: +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: +{ 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 + ''; +} + +
\ No newline at end of file diff --git a/doc/packages/xorg.xml b/doc/packages/xorg.xml new file mode 100644 index 000000000000..4526121687fc --- /dev/null +++ b/doc/packages/xorg.xml @@ -0,0 +1,34 @@ +
+ X.org + + + 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. + + + + The generator is invoked as follows: + +$ cd pkgs/servers/x11/xorg +$ cat tarballs-7.5.list extra.list old.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.) + + + + A file like tarballs-7.5.list contains all tarballs in a X.org release. It can be generated like this: + +$ export i="mirror://xorg/X11R7.4/src/everything/" +$ cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \ + | perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'i'}$2\n"; }; }' \ + | sort > tarballs-7.4.list + + extra.list contains libraries that aren’t part of X.org proper, but are closely related to it, such as libxcb. old.list contains some packages that were removed from X.org, but are still needed by some people or by other packages (such as imake). + + + + 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. + +
\ No newline at end of file From 16d733bbe58baa9e4dfd1912d13d7fdc59268212 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 20 Oct 2019 13:34:32 +0200 Subject: [PATCH 4/7] doc: move fetchers and trivial builders under builders --- doc/{functions => builders}/fetchers.xml | 8 ++++---- doc/{functions => builders}/trivial-builders.xml | 6 +++--- doc/functions.xml | 2 -- doc/manual.xml | 4 +++- 4 files changed, 10 insertions(+), 10 deletions(-) rename doc/{functions => builders}/fetchers.xml (97%) rename doc/{functions => builders}/trivial-builders.xml (97%) diff --git a/doc/functions/fetchers.xml b/doc/builders/fetchers.xml similarity index 97% rename from doc/functions/fetchers.xml rename to doc/builders/fetchers.xml index 369c1fb153eb..6f8990e8d16c 100644 --- a/doc/functions/fetchers.xml +++ b/doc/builders/fetchers.xml @@ -1,8 +1,8 @@ -
- Fetcher functions + xml:id="chap-pkgs-fetchers"> + Fetchers When using Nix, you will frequently need to download source code and other files from the internet. Nixpkgs comes with a few helper functions that allow you to fetch fixed-output derivations in a structured way. @@ -145,4 +145,4 @@ stdenv.mkDerivation { -
+
diff --git a/doc/functions/trivial-builders.xml b/doc/builders/trivial-builders.xml similarity index 97% rename from doc/functions/trivial-builders.xml rename to doc/builders/trivial-builders.xml index ae9f3a1b255d..c99425620b16 100644 --- a/doc/functions/trivial-builders.xml +++ b/doc/builders/trivial-builders.xml @@ -1,7 +1,7 @@ -
+ xml:id="chap-trivial-builders"> Trivial builders @@ -76,4 +76,4 @@ -
+ diff --git a/doc/functions.xml b/doc/functions.xml index 3e126e6b1397..81aef5f3a830 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -10,8 +10,6 @@ - - diff --git a/doc/manual.xml b/doc/manual.xml index 001a5f3eca53..d0ded1e2e167 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -21,7 +21,9 @@ - Languages, frameworks and packages + Builders + + From 9d54ea9b2d5a4fab5d6702081ad8ceacb71360d1 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Mon, 21 Oct 2019 10:57:56 +0200 Subject: [PATCH 5/7] doc: move image builders into new images chapter --- doc/builders/images.xml | 12 ++++++++++++ doc/{functions => builders/images}/appimagetools.xml | 0 doc/{functions => builders/images}/dockertools.xml | 0 doc/{functions => builders/images}/ocitools.xml | 0 .../images}/snap/example-firefox.nix | 0 .../images}/snap/example-hello.nix | 0 doc/{functions => builders/images}/snaptools.xml | 0 doc/functions.xml | 4 ---- doc/manual.xml | 1 + 9 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 doc/builders/images.xml rename doc/{functions => builders/images}/appimagetools.xml (100%) rename doc/{functions => builders/images}/dockertools.xml (100%) rename doc/{functions => builders/images}/ocitools.xml (100%) rename doc/{functions => builders/images}/snap/example-firefox.nix (100%) rename doc/{functions => builders/images}/snap/example-hello.nix (100%) rename doc/{functions => builders/images}/snaptools.xml (100%) diff --git a/doc/builders/images.xml b/doc/builders/images.xml new file mode 100644 index 000000000000..5e042a8ada80 --- /dev/null +++ b/doc/builders/images.xml @@ -0,0 +1,12 @@ + + Images + + This chapter describes tools for creating various types of images. + + + + + + diff --git a/doc/functions/appimagetools.xml b/doc/builders/images/appimagetools.xml similarity index 100% rename from doc/functions/appimagetools.xml rename to doc/builders/images/appimagetools.xml diff --git a/doc/functions/dockertools.xml b/doc/builders/images/dockertools.xml similarity index 100% rename from doc/functions/dockertools.xml rename to doc/builders/images/dockertools.xml diff --git a/doc/functions/ocitools.xml b/doc/builders/images/ocitools.xml similarity index 100% rename from doc/functions/ocitools.xml rename to doc/builders/images/ocitools.xml diff --git a/doc/functions/snap/example-firefox.nix b/doc/builders/images/snap/example-firefox.nix similarity index 100% rename from doc/functions/snap/example-firefox.nix rename to doc/builders/images/snap/example-firefox.nix diff --git a/doc/functions/snap/example-hello.nix b/doc/builders/images/snap/example-hello.nix similarity index 100% rename from doc/functions/snap/example-hello.nix rename to doc/builders/images/snap/example-hello.nix diff --git a/doc/functions/snaptools.xml b/doc/builders/images/snaptools.xml similarity index 100% rename from doc/functions/snaptools.xml rename to doc/builders/images/snaptools.xml diff --git a/doc/functions.xml b/doc/functions.xml index 81aef5f3a830..29b27d7d0dea 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -12,10 +12,6 @@ - - - - diff --git a/doc/manual.xml b/doc/manual.xml index d0ded1e2e167..525373a34272 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -24,6 +24,7 @@ Builders + From 24b1ef51337cc8267955eedda818cfccb222f2ea Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Mon, 21 Oct 2019 11:19:46 +0200 Subject: [PATCH 6/7] doc: move overrides into separate chapter --- doc/functions.xml | 1 - doc/manual.xml | 1 + doc/{functions => }/overrides.xml | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) rename doc/{functions => }/overrides.xml (98%) diff --git a/doc/functions.xml b/doc/functions.xml index 29b27d7d0dea..970367870eed 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -7,7 +7,6 @@ The nixpkgs repository has several utility functions to manipulate Nix expressions. - diff --git a/doc/manual.xml b/doc/manual.xml index 525373a34272..31c507178a8a 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -10,6 +10,7 @@ Using Nixpkgs + diff --git a/doc/functions/overrides.xml b/doc/overrides.xml similarity index 98% rename from doc/functions/overrides.xml rename to doc/overrides.xml index 4ba4283c6094..991e13a1b828 100644 --- a/doc/functions/overrides.xml +++ b/doc/overrides.xml @@ -1,7 +1,7 @@ -
+ xml:id="chap-overrides"> Overriding @@ -148,4 +148,4 @@ c = lib.makeOverridable f { a = 1; b = 2; }; The variable c however also has some additional functions, like c.override which can be used to override the default arguments. In this example the value of (c.override { a = 4; }).result is 6.
- + From 2b9713c2815aafaa410acca8600da5dbf7ca6821 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Mon, 21 Oct 2019 11:39:46 +0200 Subject: [PATCH 7/7] doc: move fhs and mkShell under builders/special In my opinion Functions should only contain pure functions. These are both meant to provide derivations so I put them under Builders. Don't know exactly *where* to put them so "special" it is... --- doc/builders/special.xml | 12 ++++++++++++ .../special}/fhs-environments.xml | 0 .../shell.xml => builders/special/mkshell.xml} | 0 doc/functions.xml | 2 -- doc/manual.xml | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 doc/builders/special.xml rename doc/{functions => builders/special}/fhs-environments.xml (100%) rename doc/{functions/shell.xml => builders/special/mkshell.xml} (100%) diff --git a/doc/builders/special.xml b/doc/builders/special.xml new file mode 100644 index 000000000000..56d98f025278 --- /dev/null +++ b/doc/builders/special.xml @@ -0,0 +1,12 @@ + + Special builders + + This chapter describes several special builders. + + + + + + diff --git a/doc/functions/fhs-environments.xml b/doc/builders/special/fhs-environments.xml similarity index 100% rename from doc/functions/fhs-environments.xml rename to doc/builders/special/fhs-environments.xml diff --git a/doc/functions/shell.xml b/doc/builders/special/mkshell.xml similarity index 100% rename from doc/functions/shell.xml rename to doc/builders/special/mkshell.xml diff --git a/doc/functions.xml b/doc/functions.xml index 970367870eed..5a9240ec800e 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -9,8 +9,6 @@ - - diff --git a/doc/manual.xml b/doc/manual.xml index 31c507178a8a..de2c70eaf352 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -25,6 +25,7 @@ Builders +