diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index ba59ceb016b..baf9b8db01b 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -12,9 +12,9 @@ - + - + diff --git a/doc/builders/packages/linux.section.md b/doc/builders/packages/linux.section.md new file mode 100644 index 00000000000..1b8d6eda749 --- /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 72d0e21493b..00000000000 --- 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. - - - - -
diff --git a/doc/builders/packages/nginx.section.md b/doc/builders/packages/nginx.section.md new file mode 100644 index 00000000000..154c21f9b36 --- /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 65854ba0236..00000000000 --- 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. - -
-
diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml index c302b67cfd5..5046ce00b9a 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 00000000000..9584c56bb52 --- /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 < - -
- diff --git a/pkgs/applications/misc/lyx/default.nix b/pkgs/applications/misc/lyx/default.nix index 34e7e145e74..3c915875096 100644 --- a/pkgs/applications/misc/lyx/default.nix +++ b/pkgs/applications/misc/lyx/default.nix @@ -3,12 +3,12 @@ }: mkDerivation rec { - version = "2.3.5.2"; + version = "2.3.6"; pname = "lyx"; src = fetchurl { url = "ftp://ftp.lyx.org/pub/lyx/stable/2.3.x/${pname}-${version}.tar.xz"; - sha256 = "1pwdh0ljd7lm5a83vsqmp4695irhig07wxa90jc23ng5gap589na"; + sha256 = "160whjwwrmxizdakjlkf9xc86bhqfnslw47fixgqq4qhbapcxxkg"; }; # LaTeX is used from $PATH, as people often want to have it with extra pkgs diff --git a/pkgs/desktops/gnome-3/extensions/gsconnect/default.nix b/pkgs/desktops/gnome-3/extensions/gsconnect/default.nix index 3d969f5c0bf..d85efd0a4da 100644 --- a/pkgs/desktops/gnome-3/extensions/gsconnect/default.nix +++ b/pkgs/desktops/gnome-3/extensions/gsconnect/default.nix @@ -9,15 +9,12 @@ , gobject-introspection , wrapGAppsHook , glib +, glib-networking , gtk3 , openssh , gnome3 , gjs , nixosTests -, atk -, harfbuzz -, pango -, gdk-pixbuf , gsettings-desktop-schemas }: @@ -55,6 +52,7 @@ stdenv.mkDerivation rec { buildInputs = [ glib # libgobject + glib-networking gtk3 gsound gjs # for running daemon @@ -87,20 +85,18 @@ stdenv.mkDerivation rec { done ''; - postFixup = let - testDeps = [ - gtk3 harfbuzz atk pango.out gdk-pixbuf - ]; - in '' + postFixup = '' # Let’s wrap the daemons for file in $out/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/service/{daemon,nativeMessagingHost}.js; do echo "Wrapping program $file" wrapGApp "$file" done - wrapProgram "$installedTests/libexec/installed-tests/gsconnect/minijasmine" \ - --prefix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}" \ - --prefix GI_TYPELIB_PATH : "${stdenv.lib.makeSearchPath "lib/girepository-1.0" testDeps}" + # Wrap jasmine runner for tests + for file in $installedTests/libexec/installed-tests/gsconnect/minijasmine; do + echo "Wrapping program $file" + wrapGApp "$file" + done ''; uuid = "gsconnect@andyholmes.github.io";