From 5c931c7299dfdc94680ffc0aa478ede5b14fab68 Mon Sep 17 00:00:00 2001 From: Renato Alves Date: Tue, 27 Oct 2020 00:15:44 +0100 Subject: docs: Add link to the GitHub issue on how to become a committer --- doc/contributing/reviewing-contributions.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/contributing/reviewing-contributions.xml b/doc/contributing/reviewing-contributions.xml index fe79d8d992b1..32607cb0cc0a 100644 --- a/doc/contributing/reviewing-contributions.xml +++ b/doc/contributing/reviewing-contributions.xml @@ -515,12 +515,8 @@ It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests. - - TODO: add the procedure to request merging rights. - - + + Please see the discussion in GitHub nixpkgs issue #50105 for information on how to proceed to be granted this level of access. + + In a case a contributor definitively leaves the Nix community, they should create an issue or post on Discourse with references of packages and modules they maintain so the maintainership can be taken over by other contributors. -- cgit 1.4.1 From a7e9047db399b8162d9596b28b68976c34e0ebf6 Mon Sep 17 00:00:00 2001 From: Stephen OBrien Date: Fri, 27 Nov 2020 08:07:30 +0000 Subject: doc: convert coq to commonmark --- doc/languages-frameworks/coq.section.md | 40 +++++++++++++++++++++++++ doc/languages-frameworks/coq.xml | 52 --------------------------------- doc/languages-frameworks/index.xml | 2 +- 3 files changed, 41 insertions(+), 53 deletions(-) create mode 100644 doc/languages-frameworks/coq.section.md delete mode 100644 doc/languages-frameworks/coq.xml (limited to 'doc') diff --git a/doc/languages-frameworks/coq.section.md b/doc/languages-frameworks/coq.section.md new file mode 100644 index 000000000000..714e84efc8db --- /dev/null +++ b/doc/languages-frameworks/coq.section.md @@ -0,0 +1,40 @@ +# Coq {#sec-language-coq} + +Coq libraries should be installed in `$(out)/lib/coq/${coq.coq-version}/user-contrib/`. Such directories are automatically added to the `$COQPATH` environment variable by the hook defined in the Coq derivation. + +Some extensions (plugins) might require OCaml and sometimes other OCaml packages. The `coq.ocamlPackages` attribute can be used to depend on the same package set Coq was built against. + +Coq libraries may be compatible with some specific versions of Coq only. The `compatibleCoqVersions` attribute is used to precisely select those versions of Coq that are compatible with this derivation. + +Here is a simple package example. It is a pure Coq library, thus it depends on Coq. It builds on the Mathematical Components library, thus it also takes `mathcomp` as `buildInputs`. Its `Makefile` has been generated using `coq_makefile` so we only have to set the `$COQLIB` variable at install time. + +```nix +{ stdenv, fetchFromGitHub, coq, mathcomp }: + +stdenv.mkDerivation rec { + name = "coq${coq.coq-version}-multinomials-${version}"; + version = "1.0"; + src = fetchFromGitHub { + owner = "math-comp"; + repo = "multinomials"; + rev = version; + sha256 = "1qmbxp1h81cy3imh627pznmng0kvv37k4hrwi2faa101s6bcx55m"; + }; + + buildInputs = [ coq ]; + propagatedBuildInputs = [ mathcomp ]; + + installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/"; + + meta = { + description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials"; + inherit (src.meta) homepage; + license = stdenv.lib.licenses.cecill-b; + inherit (coq.meta) platforms; + }; + + passthru = { + compatibleCoqVersions = v: builtins.elem v [ "8.5" "8.6" "8.7" ]; + }; +} +``` diff --git a/doc/languages-frameworks/coq.xml b/doc/languages-frameworks/coq.xml deleted file mode 100644 index 86d9226166f5..000000000000 --- a/doc/languages-frameworks/coq.xml +++ /dev/null @@ -1,52 +0,0 @@ -
- Coq - - - Coq libraries should be installed in $(out)/lib/coq/${coq.coq-version}/user-contrib/. Such directories are automatically added to the $COQPATH environment variable by the hook defined in the Coq derivation. - - - - Some extensions (plugins) might require OCaml and sometimes other OCaml packages. The coq.ocamlPackages attribute can be used to depend on the same package set Coq was built against. - - - - Coq libraries may be compatible with some specific versions of Coq only. The compatibleCoqVersions attribute is used to precisely select those versions of Coq that are compatible with this derivation. - - - - Here is a simple package example. It is a pure Coq library, thus it depends on Coq. It builds on the Mathematical Components library, thus it also takes mathcomp as buildInputs. Its Makefile has been generated using coq_makefile so we only have to set the $COQLIB variable at install time. - - - -{ stdenv, fetchFromGitHub, coq, mathcomp }: - -stdenv.mkDerivation rec { - name = "coq${coq.coq-version}-multinomials-${version}"; - version = "1.0"; - src = fetchFromGitHub { - owner = "math-comp"; - repo = "multinomials"; - rev = version; - sha256 = "1qmbxp1h81cy3imh627pznmng0kvv37k4hrwi2faa101s6bcx55m"; - }; - - buildInputs = [ coq ]; - propagatedBuildInputs = [ mathcomp ]; - - installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/"; - - meta = { - description = "A Coq/SSReflect Library for Monoidal Rings and Multinomials"; - inherit (src.meta) homepage; - license = stdenv.lib.licenses.cecill-b; - inherit (coq.meta) platforms; - }; - - passthru = { - compatibleCoqVersions = v: builtins.elem v [ "8.5" "8.6" "8.7" ]; - }; -} - -
diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml index 300c4cd2687a..4dc90df7a915 100644 --- a/doc/languages-frameworks/index.xml +++ b/doc/languages-frameworks/index.xml @@ -9,7 +9,7 @@ - + -- cgit 1.4.1 From 762e414d6af73e3b68afd40179d605e62e24d494 Mon Sep 17 00:00:00 2001 From: Jörg Thalheim Date: Sat, 28 Nov 2020 15:14:45 +0100 Subject: doc/java: convert to markdown --- doc/languages-frameworks/index.xml | 2 +- doc/languages-frameworks/java.section.md | 91 ++++++++++++++++++++++++++++++++ doc/languages-frameworks/java.xml | 77 --------------------------- 3 files changed, 92 insertions(+), 78 deletions(-) create mode 100644 doc/languages-frameworks/java.section.md delete mode 100644 doc/languages-frameworks/java.xml (limited to 'doc') diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml index 7da3321cb36f..09f8695f41ec 100644 --- a/doc/languages-frameworks/index.xml +++ b/doc/languages-frameworks/index.xml @@ -17,7 +17,7 @@ - + diff --git a/doc/languages-frameworks/java.section.md b/doc/languages-frameworks/java.section.md new file mode 100644 index 000000000000..77919d43f748 --- /dev/null +++ b/doc/languages-frameworks/java.section.md @@ -0,0 +1,91 @@ +# Java {#sec-language-java} + +Ant-based Java packages are typically built from source as follows: + +```nix +stdenv.mkDerivation { + name = "..."; + src = fetchurl { ... }; + + nativeBuildInputs = [ jdk ant ]; + + buildPhase = "ant"; +} +``` + +Note that `jdk` is an alias for the OpenJDK (self-built where available, +or pre-built via Zulu). Platforms with OpenJDK not (yet) in Nixpkgs +(`Aarch32`, `Aarch64`) point to the (unfree) `oraclejdk`. + +JAR files that are intended to be used by other packages should be +installed in `$out/share/java`. JDKs have a stdenv setup hook that add +any JARs in the `share/java` directories of the build inputs to the +`CLASSPATH` environment variable. For instance, if the package `libfoo` +installs a JAR named `foo.jar` in its `share/java` directory, and +another package declares the attribute + +```nix +buildInputs = [ libfoo ]; +nativeBuildInputs = [ jdk ]; +``` + +then `CLASSPATH` will be set to +`/nix/store/...-libfoo/share/java/foo.jar`. + +Private JARs should be installed in a location like +`$out/share/package-name`. + +If your Java package provides a program, you need to generate a wrapper +script to run it using a JRE. You can use `makeWrapper` for this: + +```nix +nativeBuildInputs = [ makeWrapper ]; + +installPhase = '' + mkdir -p $out/bin + makeWrapper ${jre}/bin/java $out/bin/foo \ + --add-flags "-cp $out/share/java/foo.jar org.foo.Main" +''; +``` + +Since the introduction of the Java Platform Module System in Java 9, +Java distributions typically no longer ship with a general-purpose JRE: +instead, they allow generating a JRE with only the modules required for +your application(s). Because we can't predict what modules will be +needed on a general-purpose system, the default jre package is the full +JDK. When building a minimal system/image, you can override the +`modules` parameter on `jre_minimal` to build a JRE with only the +modules relevant for you: + +```nix +let + my_jre = pkgs.jre_minimal.override { + modules = [ + # The modules used by 'something' and 'other' combined: + "java.base" + "java.logging" + ]; + }; + something = (pkgs.something.override { jre = my_jre; }); + other = (pkgs.other.override { jre = my_jre; }); +in + ... +``` + +Note all JDKs passthru `home`, so if your application requires +environment variables like `JAVA_HOME` being set, that can be done in a +generic fashion with the `--set` argument of `makeWrapper`: + +```bash +--set JAVA_HOME ${jdk.home} +``` + +It is possible to use a different Java compiler than `javac` from the +OpenJDK. For instance, to use the GNU Java Compiler: + +```nix +nativeBuildInputs = [ gcj ant ]; +``` + +Here, Ant will automatically use `gij` (the GNU Java Runtime) instead of +the OpenJRE. diff --git a/doc/languages-frameworks/java.xml b/doc/languages-frameworks/java.xml deleted file mode 100644 index 881d492b5bff..000000000000 --- a/doc/languages-frameworks/java.xml +++ /dev/null @@ -1,77 +0,0 @@ -
- Java - - - Ant-based Java packages are typically built from source as follows: - -stdenv.mkDerivation { - name = "..."; - src = fetchurl { ... }; - - nativeBuildInputs = [ jdk ant ]; - - buildPhase = "ant"; -} - - Note that jdk is an alias for the OpenJDK (self-built where available, or pre-built via Zulu). Platforms with OpenJDK not (yet) in Nixpkgs (Aarch32, Aarch64) point to the (unfree) oraclejdk. - - - - JAR files that are intended to be used by other packages should be installed in $out/share/java. JDKs have a stdenv setup hook that add any JARs in the share/java directories of the build inputs to the CLASSPATH environment variable. For instance, if the package libfoo installs a JAR named foo.jar in its share/java directory, and another package declares the attribute - -buildInputs = [ libfoo ]; -nativeBuildInputs = [ jdk ]; - - then CLASSPATH will be set to /nix/store/...-libfoo/share/java/foo.jar. - - - - Private JARs should be installed in a location like $out/share/package-name. - - - - If your Java package provides a program, you need to generate a wrapper script to run it using a JRE. You can use makeWrapper for this: - -nativeBuildInputs = [ makeWrapper ]; - -installPhase = - '' - mkdir -p $out/bin - makeWrapper ${jre}/bin/java $out/bin/foo \ - --add-flags "-cp $out/share/java/foo.jar org.foo.Main" - ''; - -Since the introduction of the Java Platform Module System in Java 9, Java distributions typically no longer ship with a general-purpose JRE: instead, they allow generating a JRE with only the modules required for your application(s). Because we can't predict what modules will be needed on a general-purpose system, the default jre package is the full JDK. When building a minimal system/image, you can override the modules parameter on jre_minimal to build a JRE with only the modules relevant for you: - -let - my_jre = pkgs.jre_minimal.override { - modules = [ - # The modules used by 'something' and 'other' combined: - "java.base" - "java.logging" - ]; - }; - something = (pkgs.something.override { jre = my_jre; }); - other = (pkgs.other.override { jre = my_jre; }); -in - ... - - - - - Note all JDKs passthru home, so if your application requires environment variables like JAVA_HOME being set, that can be done in a generic fashion with the --set argument of makeWrapper: - ---set JAVA_HOME ${jdk.home} - - - - - It is possible to use a different Java compiler than javac from the OpenJDK. For instance, to use the GNU Java Compiler: - -nativeBuildInputs = [ gcj ant ]; - - Here, Ant will automatically use gij (the GNU Java Runtime) instead of the OpenJRE. - -
-- cgit 1.4.1 From aa7493063a58f67f13e48699ef279c814eab198a Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Sat, 28 Nov 2020 21:33:08 -0800 Subject: doc: convert weechat docs to commonmark This is essentially an automatic pandoc conversion of the weechat section in docbook as part of the larger CommonMark Docs project (https://github.com/NixOS/nixpkgs/projects/37) fixes #105264 Update doc/builders/packages/weechat.section.md Co-authored-by: Frederik Rietdijk Update doc/builders/packages/weechat.section.md Co-authored-by: Jan Tojnar --- doc/builders/packages/index.xml | 2 +- doc/builders/packages/weechat.section.md | 85 ++++++++++++++++++++++++++++++++ doc/builders/packages/weechat.xml | 85 -------------------------------- 3 files changed, 86 insertions(+), 86 deletions(-) create mode 100644 doc/builders/packages/weechat.section.md delete mode 100644 doc/builders/packages/weechat.xml (limited to 'doc') diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index e20b0c689a80..f8be5aebcb51 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -20,6 +20,6 @@ - + diff --git a/doc/builders/packages/weechat.section.md b/doc/builders/packages/weechat.section.md new file mode 100644 index 000000000000..1d99b00e6323 --- /dev/null +++ b/doc/builders/packages/weechat.section.md @@ -0,0 +1,85 @@ +# Weechat {#sec-weechat} + +Weechat can be configured to include your choice of plugins, reducing its closure size from the default configuration which includes all available plugins. To make use of this functionality, install an expression that overrides its configuration such as + +```nix +weechat.override {configure = {availablePlugins, ...}: { + plugins = with availablePlugins; [ python perl ]; + } +} +``` + +If the `configure` function returns an attrset without the `plugins` attribute, `availablePlugins` will be used automatically. + +The plugins currently available are `python`, `perl`, `ruby`, `guile`, `tcl` and `lua`. + +The python and perl plugins allows the addition of extra libraries. For instance, the `inotify.py` script in `weechat-scripts` requires D-Bus or libnotify, and the `fish.py` script requires `pycrypto`. To use these scripts, use the plugin's `withPackages` attribute: + +```nix +weechat.override { configure = {availablePlugins, ...}: { + plugins = with availablePlugins; [ + (python.withPackages (ps: with ps; [ pycrypto python-dbus ])) + ]; + }; +} +``` + +In order to also keep all default plugins installed, it is possible to use the following method: + +```nix +weechat.override { configure = { availablePlugins, ... }: { + plugins = builtins.attrValues (availablePlugins // { + python = availablePlugins.python.withPackages (ps: with ps; [ pycrypto python-dbus ]); + }); +}; } +``` + +WeeChat allows to set defaults on startup using the `--run-command`. The `configure` method can be used to pass commands to the program: + +```nix +weechat.override { + configure = { availablePlugins, ... }: { + init = '' + /set foo bar + /server add freenode chat.freenode.org + ''; + }; +} +``` + +Further values can be added to the list of commands when running `weechat --run-command "your-commands"`. + +Additionally it's possible to specify scripts to be loaded when starting `weechat`. These will be loaded before the commands from `init`: + +```nix +weechat.override { + configure = { availablePlugins, ... }: { + scripts = with pkgs.weechatScripts; [ + weechat-xmpp weechat-matrix-bridge wee-slack + ]; + init = '' + /set plugins.var.python.jabber.key "val" + '': + }; +} +``` + +In `nixpkgs` there's a subpackage which contains derivations for WeeChat scripts. Such derivations expect a `passthru.scripts` attribute which contains a list of all scripts inside the store path. Furthermore all scripts have to live in `$out/share`. An exemplary derivation looks like this: + +```nix +{ stdenv, fetchurl }: + +stdenv.mkDerivation { + name = "exemplary-weechat-script"; + src = fetchurl { + url = "https://scripts.tld/your-scripts.tar.gz"; + sha256 = "..."; + }; + passthru.scripts = [ "foo.py" "bar.lua" ]; + installPhase = '' + mkdir $out/share + cp foo.py $out/share + cp bar.lua $out/share + ''; +} +``` diff --git a/doc/builders/packages/weechat.xml b/doc/builders/packages/weechat.xml deleted file mode 100644 index a110d3f491c7..000000000000 --- a/doc/builders/packages/weechat.xml +++ /dev/null @@ -1,85 +0,0 @@ -
- 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 - ''; -} - -
-- cgit 1.4.1 From 19973c1893837684ae228ac4f8106ad66e5ba34d Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sat, 28 Nov 2020 20:49:03 -0300 Subject: Convert Emacs documentation from XML DocBook to CommonMark --- doc/builders/packages/emacs.section.md | 119 ++++++++++++++++++++++++++++++ doc/builders/packages/emacs.xml | 131 --------------------------------- doc/builders/packages/index.xml | 2 +- 3 files changed, 120 insertions(+), 132 deletions(-) create mode 100644 doc/builders/packages/emacs.section.md delete mode 100644 doc/builders/packages/emacs.xml (limited to 'doc') diff --git a/doc/builders/packages/emacs.section.md b/doc/builders/packages/emacs.section.md new file mode 100644 index 000000000000..3829b3575bb1 --- /dev/null +++ b/doc/builders/packages/emacs.section.md @@ -0,0 +1,119 @@ +# Emacs {#sec-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: + +```nix +{ + packageOverrides = pkgs: with pkgs; { + myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ + company + counsel + flycheck + ivy + magit + projectile + use-package + ])); + } +} +``` + +You can install it like any other packages via `nix-env -iA myEmacs`. However, this will only install those packages. It will not `configure` them for us. To do this, we need to provide a configuration file. Luckily, it is possible to do this from within Nix! By modifying the above example, we can make Emacs load a custom config file. The key is to create a package that provide a `default.el` file in `/share/emacs/site-start/`. Emacs knows to load this file automatically when it starts. + +```nix +{ + packageOverrides = pkgs: with pkgs; rec { + myEmacsConfig = writeText "default.el" '' + ;; initialize package + + (require 'package) + (package-initialize 'noactivate) + (eval-when-compile + (require 'use-package)) + + ;; load some packages + + (use-package company + :bind ("<C-tab>" . company-complete) + :diminish company-mode + :commands (company-mode global-company-mode) + :defer 1 + :config + (global-company-mode)) + + (use-package counsel + :commands (counsel-descbinds) + :bind (([remap execute-extended-command] . counsel-M-x) + ("C-x C-f" . counsel-find-file) + ("C-c g" . counsel-git) + ("C-c j" . counsel-git-grep) + ("C-c k" . counsel-ag) + ("C-x l" . counsel-locate) + ("M-y" . counsel-yank-pop))) + + (use-package flycheck + :defer 2 + :config (global-flycheck-mode)) + + (use-package ivy + :defer 1 + :bind (("C-c C-r" . ivy-resume) + ("C-x C-b" . ivy-switch-buffer) + :map ivy-minibuffer-map + ("C-j" . ivy-call)) + :diminish ivy-mode + :commands ivy-mode + :config + (ivy-mode 1)) + + (use-package magit + :defer + :if (executable-find "git") + :bind (("C-x g" . magit-status) + ("C-x G" . magit-dispatch-popup)) + :init + (setq magit-completing-read-function 'ivy-completing-read)) + + (use-package projectile + :commands projectile-mode + :bind-keymap ("C-c p" . projectile-command-map) + :defer 5 + :config + (projectile-global-mode)) + ''; + + myEmacs = emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ + (runCommand "default.el" {} '' + mkdir -p $out/share/emacs/site-lisp + cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el + '') + company + counsel + flycheck + ivy + magit + projectile + use-package + ])); + }; +} +``` + +This provides a fairly full Emacs start file. It will load in addition to the user's presonal config. You can always disable it by passing `-q` to the Emacs command. + +Sometimes `emacsWithPackages` is not enough, as this package set has some priorities imposed on packages (with the lowest priority assigned to Melpa Unstable, and the highest for packages manually defined in `pkgs/top-level/emacs-packages.nix`). But you can't control this priorities when some package is installed as a dependency. You can override it on per-package-basis, providing all the required dependencies manually - but it's tedious and there is always a possibility that an unwanted dependency will sneak in through some other package. To completely override such a package you can use `overrideScope'`. + +```nix +overrides = self: super: rec { + haskell-mode = self.melpaPackages.haskell-mode; + ... +}; +((emacsPackagesGen emacs).overrideScope' overrides).emacsWithPackages + (p: with p; [ + # here both these package will use haskell-mode of our own choice + ghc-mod + dante + ]) +``` diff --git a/doc/builders/packages/emacs.xml b/doc/builders/packages/emacs.xml deleted file mode 100644 index 9cce7c40863a..000000000000 --- a/doc/builders/packages/emacs.xml +++ /dev/null @@ -1,131 +0,0 @@ -
- 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 -]) - -
-
diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index e20b0c689a80..8b83e56cf141 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -9,7 +9,7 @@ - + -- cgit 1.4.1 From e0fbc4d14caff569c06bdd1ff9bc9f8fe4ebca41 Mon Sep 17 00:00:00 2001 From: Corbin Date: Mon, 30 Nov 2020 09:36:18 -0800 Subject: doc/builders/packages/xorg: Convert to CommonMark. I had to pick 7.4 or 7.5. I picked 7.4 for now. --- doc/builders/packages/index.xml | 2 +- doc/builders/packages/xorg.section.md | 41 +++++++++++++++++++++++++++++++++++ doc/builders/packages/xorg.xml | 34 ----------------------------- 3 files changed, 42 insertions(+), 35 deletions(-) create mode 100644 doc/builders/packages/xorg.section.md delete mode 100644 doc/builders/packages/xorg.xml (limited to 'doc') diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index d967718cab39..3007c297c163 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -21,5 +21,5 @@ - + diff --git a/doc/builders/packages/xorg.section.md b/doc/builders/packages/xorg.section.md new file mode 100644 index 000000000000..c8a4c1219818 --- /dev/null +++ b/doc/builders/packages/xorg.section.md @@ -0,0 +1,41 @@ +# X.org {#sec-xorg} + +The Nix expressions for the X.org packages reside in +`pkgs/servers/x11/xorg/default.nix`. This file is automatically generated from +lists of tarballs in an X.org release. As such it should not be modified +directly; rather, you should modify the lists, the generator script or the +file `pkgs/servers/x11/xorg/overrides.nix`, in which you can override or add +to the derivations produced by the generator. + +The generator is invoked as follows: + +```sh +cd pkgs/servers/x11/xorg +cat tarballs-7.4.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.4.list` contains all tarballs in a X.org release. It +can be generated like this: + +```sh +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`. diff --git a/doc/builders/packages/xorg.xml b/doc/builders/packages/xorg.xml deleted file mode 100644 index ebf4930cc097..000000000000 --- a/doc/builders/packages/xorg.xml +++ /dev/null @@ -1,34 +0,0 @@ -
- 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. - -
-- cgit 1.4.1 From fc0f32e0f5c2b9839d92ae22dbe344e703e0d691 Mon Sep 17 00:00:00 2001 From: Corbin Date: Mon, 30 Nov 2020 10:35:21 -0800 Subject: doc/builders/packages/xorg: Acknowledge the retired katamari. I tested the shell snippets shown here; they work. Note that, because they're intended for copy-and-paste, I did *not* make them into ShellSessions with prompts. But that's something I can do if desired. --- doc/builders/packages/xorg.section.md | 49 +++++++++++++++-------------------- 1 file changed, 21 insertions(+), 28 deletions(-) (limited to 'doc') diff --git a/doc/builders/packages/xorg.section.md b/doc/builders/packages/xorg.section.md index c8a4c1219818..4e49450f43e7 100644 --- a/doc/builders/packages/xorg.section.md +++ b/doc/builders/packages/xorg.section.md @@ -1,41 +1,34 @@ # X.org {#sec-xorg} -The Nix expressions for the X.org packages reside in -`pkgs/servers/x11/xorg/default.nix`. This file is automatically generated from -lists of tarballs in an X.org release. As such it should not be modified -directly; rather, you should modify the lists, the generator script or the -file `pkgs/servers/x11/xorg/overrides.nix`, in which you can override or add -to the derivations produced by the generator. +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: +## Katamari Tarballs + +X.org upstream releases used to include [katamari](https://en.wiktionary.org/wiki/%E3%81%8B%E3%81%9F%E3%81%BE%E3%82%8A) releases, which included a holistic recommended version for each tarball, up until 7.7. To create a list of tarballs in a katamari release: ```sh -cd pkgs/servers/x11/xorg -cat tarballs-7.4.list extra.list old.list | perl ./generate-expr-from-tarballs.pl +export release="X11R7.7" +export url="mirror://xorg/X11R7.4/src/everything/" +cat $(PRINT_PATH=1 nix-prefetch-url $url | tail -n 1) \ + | perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'url'}$2\n"; }; }' \ + | sort > "tarballs-$release.list" ``` -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.) +## Individual Tarballs + +The upstream release process for [X11R7.8](https://x.org/wiki/Releases/7.8/) does not include a planned katamari. Instead, each component of X.org is released as its own tarball. We maintain `pkgs/servers/x11/xorg/tarballs.list` as a list of tarballs for each individual package. This list includes X.org core libraries and protocol descriptions, extra newer X11 interface libraries, like `xorg.libxcb`, and classic utilities which are largely unused but still available if needed, like `xorg.imake`. -A file like `tarballs-7.4.list` contains all tarballs in a X.org release. It -can be generated like this: +## Generating Nix Expressions + +The generator is invoked as follows: ```sh -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 +cd pkgs/servers/x11/xorg + Date: Mon, 30 Nov 2020 11:36:34 -0800 Subject: doc/builders/packages/xorg: Fix pasto. I did double-check that the fixed version does what we would want. In either case, the katamari script is mostly of historical value, and there's nothing to change in pkgs. --- doc/builders/packages/xorg.section.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/builders/packages/xorg.section.md b/doc/builders/packages/xorg.section.md index 4e49450f43e7..92df9e5464a3 100644 --- a/doc/builders/packages/xorg.section.md +++ b/doc/builders/packages/xorg.section.md @@ -8,7 +8,7 @@ X.org upstream releases used to include [katamari](https://en.wiktionary.org/wik ```sh export release="X11R7.7" -export url="mirror://xorg/X11R7.4/src/everything/" +export url="mirror://xorg/$release/src/everything/" cat $(PRINT_PATH=1 nix-prefetch-url $url | tail -n 1) \ | perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'url'}$2\n"; }; }' \ | sort > "tarballs-$release.list" -- cgit 1.4.1 From 874e3587eef756c7845d63cffe00a2f3662a8aee Mon Sep 17 00:00:00 2001 From: Corbin Date: Mon, 30 Nov 2020 22:03:23 -0800 Subject: doc/builders/packages/xorg: Use ShellSession for shell. I was worried, but the HTML output can still be copy-and-pasted, so it's not a problem. --- doc/builders/packages/xorg.section.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/builders/packages/xorg.section.md b/doc/builders/packages/xorg.section.md index 92df9e5464a3..be220a25404a 100644 --- a/doc/builders/packages/xorg.section.md +++ b/doc/builders/packages/xorg.section.md @@ -6,7 +6,7 @@ The Nix expressions for the X.org packages reside in `pkgs/servers/x11/xorg/defa X.org upstream releases used to include [katamari](https://en.wiktionary.org/wiki/%E3%81%8B%E3%81%9F%E3%81%BE%E3%82%8A) releases, which included a holistic recommended version for each tarball, up until 7.7. To create a list of tarballs in a katamari release: -```sh +```ShellSession export release="X11R7.7" export url="mirror://xorg/$release/src/everything/" cat $(PRINT_PATH=1 nix-prefetch-url $url | tail -n 1) \ @@ -22,7 +22,7 @@ The upstream release process for [X11R7.8](https://x.org/wiki/Releases/7.8/) doe The generator is invoked as follows: -```sh +```ShellSession cd pkgs/servers/x11/xorg Date: Mon, 30 Nov 2020 22:10:43 -0800 Subject: doc/builders/packages/opengl: Convert to CommonMark. (#105485) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc/builders/packages/opengl: Convert to CommonMark. * Update doc/builders/packages/opengl.section.md NVIDIA™ Co-authored-by: Ryan Mulligan * Update doc/builders/packages/opengl.section.md NVIDIA™ Co-authored-by: Ryan Mulligan Co-authored-by: Ryan Mulligan --- doc/builders/packages/index.xml | 2 +- doc/builders/packages/opengl.section.md | 15 +++++++++++++++ doc/builders/packages/opengl.xml | 9 --------- 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 doc/builders/packages/opengl.section.md delete mode 100644 doc/builders/packages/opengl.xml (limited to 'doc') diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index 3007c297c163..ba59ceb016b6 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -15,7 +15,7 @@ - + diff --git a/doc/builders/packages/opengl.section.md b/doc/builders/packages/opengl.section.md new file mode 100644 index 000000000000..6866bf89221a --- /dev/null +++ b/doc/builders/packages/opengl.section.md @@ -0,0 +1,15 @@ +# OpenGL {#sec-opengl} + +OpenGL support varies depending on which hardware is used and which drivers are available and loaded. + +Broadly, we support both GL vendors: Mesa and NVIDIA. + +## NixOS Desktop + +The NixOS desktop or other non-headless configurations are the primary target for OpenGL libraries and applications. The current solution for discovering which drivers are available is based on [libglvnd](https://gitlab.freedesktop.org/glvnd/libglvnd). `libglvnd` performs "vendor-neutral dispatch", trying a variety of techniques to find the system's GL implementation. In practice, this will be either via standard GLX for X11 users or EGL for Wayland users, and supporting either NVIDIA or Mesa extensions. + +## Nix on GNU/Linux + +If you are using a non-NixOS GNU/Linux/X11 desktop with free software video drivers, consider launching OpenGL-dependent programs from Nixpkgs with Nixpkgs versions of `libglvnd` and `mesa.drivers` in `LD_LIBRARY_PATH`. For Mesa drivers, the Linux kernel version doesn't have to match nixpkgs. + +For proprietary video drivers you might have luck with also adding the corresponding video driver package. diff --git a/doc/builders/packages/opengl.xml b/doc/builders/packages/opengl.xml deleted file mode 100644 index dfd64b188586..000000000000 --- a/doc/builders/packages/opengl.xml +++ /dev/null @@ -1,9 +0,0 @@ -
- 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. - -
-- cgit 1.4.1 From 58baa3f39cf06fd82106be89a143976c28b21b55 Mon Sep 17 00:00:00 2001 From: Justus K Date: Wed, 2 Dec 2020 20:14:05 +0100 Subject: convert nginx documentation to common mark --- doc/builders/packages/index.xml | 2 +- doc/builders/packages/nginx.section.md | 11 +++++++++++ doc/builders/packages/nginx.xml | 25 ------------------------- 3 files changed, 12 insertions(+), 26 deletions(-) create mode 100644 doc/builders/packages/nginx.section.md delete mode 100644 doc/builders/packages/nginx.xml (limited to 'doc') diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index ba59ceb016b6..44e89169629d 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -14,7 +14,7 @@ - + diff --git a/doc/builders/packages/nginx.section.md b/doc/builders/packages/nginx.section.md new file mode 100644 index 000000000000..154c21f9b369 --- /dev/null +++ b/doc/builders/packages/nginx.section.md @@ -0,0 +1,11 @@ +# Nginx {#sec-nginx} + +[Nginx](https://nginx.org) is a reverse proxy and lightweight webserver. + +## ETags on static files served from the Nix store {#sec-nginx-etag} + +HTTP has a couple different mechanisms for caching to prevent clients from having to download the same content repeatedly if a resource has not changed since the last time it was requested. When nginx is used as a server for static files, it implements the caching mechanism based on the [`Last-Modified`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified) response header automatically; unfortunately, it works by using filesystem timestamps to determine the value of the `Last-Modified` header. This doesn't give the desired behavior when the file is in the Nix store, because all file timestamps are set to 0 (for reasons related to build reproducibility). + +Fortunately, HTTP supports an alternative (and more effective) caching mechanism: the [`ETag`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) response header. The value of the `ETag` header specifies some identifier for the particular content that the server is sending (e.g. a hash). When a client makes a second request for the same resource, it sends that value back in an `If-None-Match` header. If the ETag value is unchanged, then the server does not need to resend the content. + +As of NixOS 19.09, the nginx package in Nixpkgs is patched such that when nginx serves a file out of `/nix/store`, the hash in the store path is used as the `ETag` header in the HTTP response, thus providing proper caching functionality. This happens automatically; you do not need to do modify any configuration to get this behavior. diff --git a/doc/builders/packages/nginx.xml b/doc/builders/packages/nginx.xml deleted file mode 100644 index 65854ba02366..000000000000 --- a/doc/builders/packages/nginx.xml +++ /dev/null @@ -1,25 +0,0 @@ -
- 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. - -
-
-- cgit 1.4.1 From cb912fe2d3a3453c86d51fd8aef5e32d1d18d56d Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Wed, 2 Dec 2020 11:13:37 -0500 Subject: docs: convert packages/linux docbook -> commonmark Closes #105257 --- doc/builders/packages/index.xml | 2 +- doc/builders/packages/linux.section.md | 41 ++++++++++++++++ doc/builders/packages/linux.xml | 85 ---------------------------------- 3 files changed, 42 insertions(+), 86 deletions(-) create mode 100644 doc/builders/packages/linux.section.md delete mode 100644 doc/builders/packages/linux.xml (limited to 'doc') diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index ba59ceb016b6..ac6144bf2cdd 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -12,7 +12,7 @@ - + diff --git a/doc/builders/packages/linux.section.md b/doc/builders/packages/linux.section.md new file mode 100644 index 000000000000..1b8d6eda749d --- /dev/null +++ b/doc/builders/packages/linux.section.md @@ -0,0 +1,41 @@ +# Linux kernel {#sec-linux-kernel} + +The Nix expressions to build the Linux kernel are in [`pkgs/os-specific/linux/kernel`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel). + +The function that builds the kernel has an argument `kernelPatches` which should be a list of `{name, patch, extraConfig}` attribute sets, where `name` is the name of the patch (which is included in the kernel’s `meta.description` attribute), `patch` is the patch itself (possibly compressed), and `extraConfig` (optional) is a string specifying extra options to be concatenated to the kernel configuration file (`.config`). + +The kernel derivation exports an attribute `features` specifying whether optional functionality is or isn’t enabled. This is used in NixOS to implement kernel-specific behaviour. For instance, if the kernel has the `iwlwifi` feature (i.e. has built-in support for Intel wireless chipsets), then NixOS doesn’t have to build the external `iwlwifi` package: + +```nix +modulesTree = [kernel] + ++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi + ++ ...; +``` + +How to add a new (major) version of the Linux kernel to Nixpkgs: + +1. Copy the old Nix expression (e.g. `linux-2.6.21.nix`) to the new one (e.g. `linux-2.6.22.nix`) and update it. + +2. Add the new kernel to `all-packages.nix` (e.g., create an attribute `kernel_2_6_22`). + +3. Now we’re going to update the kernel configuration. First unpack the kernel. Then for each supported platform (`i686`, `x86_64`, `uml`) do the following: + + 1. Make an copy from the old config (e.g. `config-2.6.21-i686-smp`) to the new one (e.g. `config-2.6.22-i686-smp`). + + 2. Copy the config file for this platform (e.g. `config-2.6.22-i686-smp`) to `.config` in the kernel source tree. + + 3. Run `make oldconfig ARCH={i386,x86_64,um}` and answer all questions. (For the uml configuration, also add `SHELL=bash`.) Make sure to keep the configuration consistent between platforms (i.e. don’t enable some feature on `i686` and disable it on `x86_64`). + + 4. If needed you can also run `make menuconfig`: + + ```ShellSession + $ nix-env -i ncurses + $ export NIX_CFLAGS_LINK=-lncurses + $ make menuconfig ARCH=arch + ``` + + 5. Copy `.config` over the new config file (e.g. `config-2.6.22-i686-smp`). + +4. Test building the kernel: `nix-build -A kernel_2_6_22`. If it compiles, ship it! For extra credit, try booting NixOS with it. + +5. It may be that the new kernel requires updating the external kernel modules and kernel-dependent packages listed in the `linuxPackagesFor` function in `all-packages.nix` (such as the NVIDIA drivers, AUFS, etc.). If the updated packages aren’t backwards compatible with older kernels, you may need to keep the older versions around. diff --git a/doc/builders/packages/linux.xml b/doc/builders/packages/linux.xml deleted file mode 100644 index 72d0e21493b3..000000000000 --- a/doc/builders/packages/linux.xml +++ /dev/null @@ -1,85 +0,0 @@ -
- 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. - - - - -
-- cgit 1.4.1 From 543f084d62cb357346d2c18bbec920dbb7a304a2 Mon Sep 17 00:00:00 2001 From: Lucas Eduardo Date: Thu, 3 Dec 2020 02:15:18 -0300 Subject: doc: TeX Live to CommonMark * converted texlive doc to markdown Signed-off-by: GitHub * Remove frontmatter (suggestion) Co-authored-by: Ryan Mulligan * Add anchor (suggestion) Co-authored-by: Ryan Mulligan * apply suggestions from @ryantm Signed-off-by: GitHub * fix nesting of codeblocks into list items as suggested by @jtojnar Signed-off-by: GitHub * add anchors for subtopics as said by @jtojnar Signed-off-by: GitHub Co-authored-by: Ryan Mulligan --- doc/languages-frameworks/index.xml | 2 +- doc/languages-frameworks/texlive.section.md | 128 +++++++++++++++++++++++ doc/languages-frameworks/texlive.xml | 152 ---------------------------- 3 files changed, 129 insertions(+), 153 deletions(-) create mode 100644 doc/languages-frameworks/texlive.section.md delete mode 100644 doc/languages-frameworks/texlive.xml (limited to 'doc') diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml index c302b67cfd54..5046ce00b9a9 100644 --- a/doc/languages-frameworks/index.xml +++ b/doc/languages-frameworks/index.xml @@ -29,7 +29,7 @@ - + diff --git a/doc/languages-frameworks/texlive.section.md b/doc/languages-frameworks/texlive.section.md new file mode 100644 index 000000000000..9584c56bb52f --- /dev/null +++ b/doc/languages-frameworks/texlive.section.md @@ -0,0 +1,128 @@ + +# TeX Live {#sec-language-texlive} + +Since release 15.09 there is a new TeX Live packaging that lives entirely under attribute `texlive`. + +## User's guide {#sec-language-texlive-user-guide} + +- For basic usage just pull `texlive.combined.scheme-basic` for an environment with basic LaTeX support. +- It typically won't work to use separately installed packages together. Instead, you can build a custom set of packages like this: + + ```nix + texlive.combine { + inherit (texlive) scheme-small collection-langkorean algorithms cm-super; + } + ``` + +- There are all the schemes, collections and a few thousand packages, as defined upstream (perhaps with tiny differences). +- By default you only get executables and files needed during runtime, and a little documentation for the core packages. To change that, you need to add `pkgFilter` function to `combine`. + + ```nix + texlive.combine { + # inherit (texlive) whatever-you-want; + pkgFilter = pkg: + pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "cm-super"; + # elem tlType [ "run" "bin" "doc" "source" ] + # there are also other attributes: version, name + } + ``` + +- You can list packages e.g. by `nix repl`. + + ```ShellSession + $ nix repl + nix-repl> :l + nix-repl> texlive.collection-[TAB] + ``` + +- Note that the wrapper assumes that the result has a chance to be useful. For example, the core executables should be present, as well as some core data files. The supported way of ensuring this is by including some scheme, for example `scheme-basic`, into the combination. + +## Custom packages {#sec-language-texlive-custom-packages} + + +You may find that you need to use an external TeX package. A derivation for such package has to provide contents of the "texmf" directory in its output and provide the `tlType` attribute. Here is a (very verbose) example: + +```nix +with import {}; + +let + foiltex_run = stdenvNoCC.mkDerivation { + pname = "latex-foiltex"; + version = "2.1.4b"; + passthru.tlType = "run"; + + srcs = [ + (fetchurl { + url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.dtx"; + sha256 = "07frz0krpz7kkcwlayrwrj2a2pixmv0icbngyw92srp9fp23cqpz"; + }) + (fetchurl { + url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.ins"; + sha256 = "09wkyidxk3n3zvqxfs61wlypmbhi1pxmjdi1kns9n2ky8ykbff99"; + }) + ]; + + unpackPhase = '' + runHook preUnpack + + for _src in $srcs; do + cp "$_src" $(stripHash "$_src") + done + + runHook postUnpack + ''; + + nativeBuildInputs = [ texlive.combined.scheme-small ]; + + dontConfigure = true; + + buildPhase = '' + runHook preBuild + + # Generate the style files + latex foiltex.ins + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + path="$out/tex/latex/foiltex" + mkdir -p "$path" + cp *.{cls,def,clo} "$path/" + + runHook postInstall + ''; + + meta = with lib; { + description = "A LaTeX2e class for overhead transparencies"; + license = licenses.unfreeRedistributable; + maintainers = with maintainers; [ veprbl ]; + platforms = platforms.all; + }; + }; + foiltex = { pkgs = [ foiltex_run ]; }; + + latex_with_foiltex = texlive.combine { + inherit (texlive) scheme-small; + inherit foiltex; + }; +in + runCommand "test.pdf" { + nativeBuildInputs = [ latex_with_foiltex ]; + } '' +cat >test.tex < - TeX Live - - - Since release 15.09 there is a new TeX Live packaging that lives entirely under attribute texlive. - - -
- User's guide - - - - - For basic usage just pull texlive.combined.scheme-basic for an environment with basic LaTeX support. - - - - - It typically won't work to use separately installed packages together. Instead, you can build a custom set of packages like this: - -texlive.combine { - inherit (texlive) scheme-small collection-langkorean algorithms cm-super; -} - - There are all the schemes, collections and a few thousand packages, as defined upstream (perhaps with tiny differences). - - - - - By default you only get executables and files needed during runtime, and a little documentation for the core packages. To change that, you need to add pkgFilter function to combine. - -texlive.combine { - # inherit (texlive) whatever-you-want; - pkgFilter = pkg: - pkg.tlType == "run" || pkg.tlType == "bin" || pkg.pname == "cm-super"; - # elem tlType [ "run" "bin" "doc" "source" ] - # there are also other attributes: version, name -} - - - - - - You can list packages e.g. by nix repl. - -$ nix repl -nix-repl> :l <nixpkgs> -nix-repl> texlive.collection- - - - - - - Note that the wrapper assumes that the result has a chance to be useful. For example, the core executables should be present, as well as some core data files. The supported way of ensuring this is by including some scheme, for example scheme-basic, into the combination. - - - -
- -
- Custom packages - - You may find that you need to use an external TeX package. A derivation for such package has to provide contents of the "texmf" directory in its output and provide the tlType attribute. Here is a (very verbose) example: - {}; - -let - foiltex_run = stdenvNoCC.mkDerivation { - pname = "latex-foiltex"; - version = "2.1.4b"; - passthru.tlType = "run"; - - srcs = [ - (fetchurl { - url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.dtx"; - sha256 = "07frz0krpz7kkcwlayrwrj2a2pixmv0icbngyw92srp9fp23cqpz"; - }) - (fetchurl { - url = "http://mirrors.ctan.org/macros/latex/contrib/foiltex/foiltex.ins"; - sha256 = "09wkyidxk3n3zvqxfs61wlypmbhi1pxmjdi1kns9n2ky8ykbff99"; - }) - ]; - - unpackPhase = '' - runHook preUnpack - - for _src in $srcs; do - cp "$_src" $(stripHash "$_src") - done - - runHook postUnpack - ''; - - nativeBuildInputs = [ texlive.combined.scheme-small ]; - - dontConfigure = true; - - buildPhase = '' - runHook preBuild - - # Generate the style files - latex foiltex.ins - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - path="$out/tex/latex/foiltex" - mkdir -p "$path" - cp *.{cls,def,clo} "$path/" - - runHook postInstall - ''; - - meta = with lib; { - description = "A LaTeX2e class for overhead transparencies"; - license = licenses.unfreeRedistributable; - maintainers = with maintainers; [ veprbl ]; - platforms = platforms.all; - }; - }; - foiltex = { pkgs = [ foiltex_run ]; }; - - latex_with_foiltex = texlive.combine { - inherit (texlive) scheme-small; - inherit foiltex; - }; -in - runCommand "test.pdf" { - nativeBuildInputs = [ latex_with_foiltex ]; - } '' -cat >test.tex < - -
- -- cgit 1.4.1