Commit Graph

50 Commits

Author SHA1 Message Date
Graham Christensen
f835f77e02
nixpkgs: Start documenting library functions in XML
Covers assert functions and about half of the attrsets functions.

Some internal consistency around IDs could be improved.
2018-10-05 10:06:08 -04:00
Graham Christensen
c3125498fd
shell functions: rewrite as xml 2018-10-02 14:16:27 -04:00
Graham Christensen
507a63c885
nixpkgs docs: move shell section to its own file 2018-10-02 14:13:42 -04:00
Graham Christensen
8bf342ffb8
nixpkgs docs: move dockertool to its own file 2018-10-02 14:13:12 -04:00
Graham Christensen
0856d5c4ad
nixpkgs docs: move fhs-environments to its own file 2018-10-02 14:08:36 -04:00
Graham Christensen
3ac79c89b7
nixpkgs docs: move debug to its own file 2018-10-02 14:07:06 -04:00
Graham Christensen
9ae39b3553
nixpkgs docs: move generators to its own file 2018-10-02 14:03:59 -04:00
Graham Christensen
f200a322c4
nixpkgs docs: move overrides to its own file 2018-10-02 13:52:21 -04:00
Graham Christensen
d1e46df24b fixup: drop comment about config behaving differently from buildImage 2018-09-27 08:14:04 -04:00
Graham Christensen
4fe9006190 dockerTools.buildLayeredImage: init
Create a many-layered Docker Image.

Implements much less than buildImage:

 - Doesn't support specific uids/gids
 - Doesn't support runninng commands after building
 - Doesn't require qemu
 - Doesn't create mutable copies of the files in the path
 - Doesn't support parent images

If you want those feature, I recommend using buildLayeredImage as an
input to buildImage.

Notably, it does support:

 - Caching low level, common paths based on a graph traversial
   algorithm, see referencesByPopularity in
   0a80233487993256e811f566b1c80a40394c03d6
 - Configurable number of layers. If you're not using AUFS or not
   extending the image, you can specify a larger number of layers at
   build time:

       pkgs.dockerTools.buildLayeredImage {
         name = "hello";
         maxLayers = 128;
         config.Cmd = [ "${pkgs.gitFull}/bin/git" ];
       };

 - Parallelized creation of the layers, improving build speed.
 - The contents of the image includes the closure of the configuration,
   so you don't have to specify paths in contents and config.

   With buildImage, paths referred to by the config were not included
   automatically in the image. Thus, if you wanted to call Git, you
   had to specify it twice:

       pkgs.dockerTools.buildImage {
         name = "hello";
         contents = [ pkgs.gitFull ];
         config.Cmd = [ "${pkgs.gitFull}/bin/git" ];
       };

   buildLayeredImage on the other hand includes the runtime closure of
   the config when calculating the contents of the image:

       pkgs.dockerTools.buildImage {
         name = "hello";
         config.Cmd = [ "${pkgs.gitFull}/bin/git" ];
       };

Minor Problems

 - If any of the store paths change, every layer will be rebuilt in
   the nix-build. However, beacuse the layers are bit-for-bit
   reproducable, when these images are loaded in to Docker they will
   match existing layers and not be imported or uploaded twice.

Common Questions

 - Aren't Docker layers ordered?

   No. People who have used a Dockerfile before assume Docker's
   Layers are inherently ordered. However, this is not true -- Docker
   layers are content-addressable and are not explicitly layered until
   they are composed in to an Image.

 - What happens if I have more than maxLayers of store paths?

   The first (maxLayers-2) most "popular" paths will have their own
   individual layers, then layer #(maxLayers-1) will contain all the
   remaining "unpopular" paths, and finally layer #(maxLayers) will
   contain the Image configuration.
2018-09-26 17:54:14 -04:00
Graham Christensen
7736337916
Clarfy the binary reproducibility problems of created=now with dockerTools.buildImage. 2018-09-20 20:23:04 -04:00
Graham Christensen
a32d7e0c74 dockerTools.buildImage: support impure dates
Because dates are an impurity, by default buildImage will use a static
date of one second past the UNIX Epoch. This can be a bit frustrating
when listing docker images in the CLI:

    $ docker image list
    REPOSITORY   TAG      IMAGE ID       CREATED        SIZE
    hello        latest   08c791c7846e   48 years ago   25.2MB

If you want to trade the purity for a better user experience, you can
set created to now.

    pkgs.dockerTools.buildImage {
      name = "hello";
      tag = "latest";
      created = "now";
      contents = pkgs.hello;

      config.Cmd = [ "/bin/hello" ];
    }

and now the Docker CLI will display a reasonable date and sort the
images as expected:

    $ docker image list
    REPOSITORY   TAG      IMAGE ID       CREATED              SIZE
    hello        latest   de2bf4786de6   About a minute ago   25.2MB
2018-09-20 18:26:02 +02:00
Eelco Dolstra
eac06ed070
Manual: Random indentation fixes 2018-09-03 17:13:46 +02:00
Graham Christensen
360f420ac7
nixpkgs docs: normalize 2018-08-27 19:54:41 -04:00
Graham Christensen
53371b15c6
docs: include shell section 2018-08-27 19:53:25 -04:00
Nick Novitski
c58b11d229 dockerTools.pullImage: control OS and architecture 2018-07-27 12:29:31 -07:00
Mathias Schreck
39e678e24e dockerTools.buildImage: add option to use nix output hash as tag 2018-07-06 15:15:09 +02:00
Samuel Dionne-Riel
a45edd9024 doc: ran make format
With visual inspection that nothing got worse.
2018-05-31 21:03:37 -04:00
Antoine Eiche
d35dcb1280 dockerTools.pullImage: documentation and release note 2018-05-02 21:32:20 +02:00
Graham Christensen
77161de454
nixpkgs docs: format =) 2018-05-01 19:54:21 -04:00
Profpatsch
21b87a7bdb docs: initial manual entry for lib/debug.nix
It is more of a stub for now, but at least points to the right file.
2018-04-27 18:59:39 +02:00
Profpatsch
e01d485ce4 lib/generators: add an example of overriding defaults
An example of overriding the `toINI` generator is added,
hopefully clarifying the expressiveness of generators.
2018-03-29 16:53:06 +02:00
Mathias Schreck
cd3d852943 dockerTools: document image spec v1.2 compatibility 2017-08-03 11:52:03 +02:00
Jan Tojnar
e35f3c0679
doc: Fix some typos 2017-06-11 22:13:42 +02:00
Jörg Thalheim
36fca93290
rename iana_etc to iana-etc
fixes #23621
2017-03-28 22:35:15 +02:00
Paul Kinsky
b14dd0e6c3
wrap added notes in <note> 2017-02-20 22:25:32 -05:00
Paul Kinsky
2d78767973
Add tips for resolving https issues in containers
I ran into some issues making HTTPS requests from a container built with buildImage. I've added notes with tips for resolving similar issues.
2017-02-20 22:24:54 -05:00
Eelco Dolstra
9d6a55aefd
~/.nixpkgs -> ~/.config/nixpkgs
The former is still respected as a fallback for config.nix for
backwards compatibility (but not for overlays because they're a new
feature).
2017-02-01 16:07:55 +01:00
Nicolas B. Pierron
f5dfe78a1e Add overlays mechanism to Nixpkgs.
This patch add a new argument to Nixpkgs default expression named "overlays".

By default, the value of the argument is either taken from the environment variable `NIXPKGS_OVERLAYS`,
or from the directory `~/.nixpkgs/overlays/`.  If the environment variable does not name a valid directory
then this mechanism would fallback on the home directory.  If the home directory does not exists it will
fallback on an empty list of overlays.

The overlays directory should contain the list of extra Nixpkgs stages which would be used to extend the
content of Nixpkgs, with additional set of packages.  The overlays, i-e directory, files, symbolic links
are used in alphabetical order.

The simplest overlay which extends Nixpkgs with nothing looks like:

```nix
self: super: {
}
```

More refined overlays can use `super` as the basis for building new packages, and `self` as a way to query
the final result of the fix-point.

An example of overlay which extends Nixpkgs with a small set of packages can be found at:
  https://github.com/nbp/nixpkgs-mozilla/blob/nixpkgs-overlay/moz-overlay.nix

To use this file, checkout the repository and add a symbolic link to
the `moz-overlay.nix` file in `~/.nixpkgs/overlays` directory.
2017-01-16 01:17:33 +01:00
Kier Davis
cb4ebb6749
docs: fix a couple of unmatched parentheses 2017-01-12 21:04:20 +00:00
Profpatsch
53fc7b8272 lib/generators: add manual documentation
Restructures the functions reference a bit.
2016-11-17 23:19:28 +01:00
Domen Kožar
62edf873aa Merge pull request #18660 from aneeshusa/add-override-attrs
mkDerivation: add overrideAttrs function
2016-10-30 11:32:15 +01:00
Joachim Fasting
a1ecc5648a
nixpkgs doc: fix build
Ref e4cd45a30c
2016-10-28 16:28:31 +02:00
John Ericson
e4cd45a30c top-level: Make overridePackages extend rather than replace existing overrides 2016-10-13 11:14:11 -04:00
Aneesh Agrawal
39b64b52ed mkDerivation: add overrideAttrs function
This is similar to `overrideDerivation`, but overrides the arguments to
`mkDerivation` instead of the underlying `derivation` call.

Also update `makeOverridable` so that uses of `overrideAttrs` can be
followed by `override` and `overrideDerivation`, i.e. they can be
mix-and-matched.
2016-10-02 11:08:34 -04:00
Alex Berg
b5a95b1812 Improve overrideDerivation docs. (#16867)
* Improve overrideDerivation docs.

Explain how antiquotation in a package's attribute behaves when overriding the package.

* Edit antiquotation note. Fix closing-element.
2016-07-12 09:57:26 +02:00
Nikolay Amiantov
75ea0523c4 doc: update buildFHSUserEnv documentation 2016-06-09 18:20:56 +03:00
Domen Kožar
dee13c7fd4 doc: mention overrideDerivation causes evaluation of Derivation 2016-05-30 12:34:03 +01:00
Arthur Noel
903129f770 dockerTools: private registry support
* authorization token is optional
* registry url is taken from X-Docker-Endpoints header
* pull.sh correctly resumes partial layer downloads
* detjson.py does not fail on missing keys
2016-01-27 21:13:07 +00:00
Luca Bruno
4a4561ce24 dockerTools: nix functions for manipulating docker images 2016-01-13 10:27:37 +01:00
Avery Glitch
b72bcd1e32 Fixed a syntax error in the buildFHSChrootEnv example. Also, fixed the manual.xml so it actually builds. 2015-12-18 00:22:51 +11:00
Eelco Dolstra
f7c25bf9c2 Manual: Add a warning that overrideDerivation should not be used 2015-12-02 13:54:24 +01:00
Nikolay Amiantov
fa53fbe086 build-fhs-{chroot,user}env: document new extra bind mounts option 2015-10-11 17:53:03 +03:00
Vladimír Čunát
1eb5566af5 doc/functions: fix a typo 2015-09-24 11:07:53 +02:00
Vladimír Čunát
88c9f8b574 xlibs: replace occurrences by xorg
This seems to have been confusing people, using both xlibs and xorg, etc.
- Avoided renaming local (and different) xlibs binding in gcc*.
- Fixed cases where both xorg and xlibs were used.
Hopefully everything still works as before.
2015-09-15 12:54:34 +02:00
Nikolay Amiantov
f04db6d3e7 buildFHS*Env: add documentation 2015-08-26 20:34:13 +03:00
Luca Bruno
5dfb469faf doc: document .overrideDerivation 2015-07-30 17:56:39 +02:00
Luca Bruno
e06f494a81 doc: document lib.makeOverridable 2015-06-30 12:19:49 +02:00
Luca Bruno
01ce5ce050 doc: document .override 2015-06-30 11:26:27 +02:00
Luca Bruno
7f5f9072ad all-packages.nix: Add pkgs.overridePackages 2015-06-26 15:08:11 +02:00