Commit Graph
153474 Commits
Author SHA1 Message Date
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 fd045173ce referencesByPopularity: init to sort packages by a cachability heuristic
Using a simple algorithm, convert the references to a path in to a
sorted list of dependent paths based on how often they're referenced
and how deep in the tree they live. Equally-"popular" paths are then
sorted by name.

The existing writeReferencesToFile prints the paths in a simple
ascii-based sorting of the paths.

Sorting the paths by graph improves the chances that the difference
between two builds appear near the end of the list, instead of near
the beginning. This makes a difference for Nix builds which export a
closure for another program to consume, if that program implements its
own level of binary diffing.

For an example, Docker Images. If each store path is a separate layer
then Docker Images can be very efficiently transfered between systems,
and we get very good cache reuse between images built with the same
version of Nixpkgs. However, since Docker only reliably supports a
small number of layers (42) it is important to pick the individual
layers carefully. By storing very popular store paths in the first 40
layers, we improve the chances that the next Docker image will share
many of those layers.*

Given the dependency tree:

    A - B - C - D -\
     \   \   \      \
      \   \   \      \
       \   \ - E ---- F
        \- G

Nodes which have multiple references are duplicated:

    A - B - C - D - F
     \   \   \
      \   \   \- E - F
       \   \
        \   \- E - F
         \
          \- G

Each leaf node is now replaced by a counter defaulted to 1:

    A - B - C - D - (F:1)
     \   \   \
      \   \   \- E - (F:1)
       \   \
        \   \- E - (F:1)
         \
          \- (G:1)

Then each leaf counter is merged with its parent node, replacing the
parent node with a counter of 1, and each existing counter being
incremented by 1. That is to say `- D - (F:1)` becomes `- (D:1, F:2)`:

    A - B - C - (D:1, F:2)
     \   \   \
      \   \   \- (E:1, F:2)
       \   \
        \   \- (E:1, F:2)
         \
          \- (G:1)

Then each leaf counter is merged with its parent node again, merging
any counters, then incrementing each:

    A - B - (C:1, D:2, E:2, F:5)
     \   \
      \   \- (E:1, F:2)
       \
        \- (G:1)

And again:

    A - (B:1, C:2, D:3, E:4, F:8)
     \
      \- (G:1)

And again:

    (A:1, B:2, C:3, D:4, E:5, F:9, G:2)

and then paths have the following "popularity":

    A     1
    B     2
    C     3
    D     4
    E     5
    F     9
    G     2

and the popularity contest would result in the paths being printed as:

    F
    E
    D
    C
    B
    G
    A

* Note: 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.
2018-09-26 15:50:10 -04:00
Graham Christensen 2bf0ee3b2b dockertools: tarsum: turn in to a buildInput 2018-09-26 15:50:04 -04:00
Jörg ThalheimandGitHub 725b57ba11 Merge pull request #47283 from flokli/elasticsearch-dsl-6.2.1
pythonPackages.elasticsearch-dsl: 0.0.9 -> 6.2.1
2018-09-24 20:40:21 +01:00
Peter Simons f705ee21f6 Update overrides for ghc-8.6.x. 2018-09-24 21:19:35 +02:00
Peter Simons 873476c55a haskell-hspec-core: use latest version when building with ghc 8.6.x 2018-09-24 21:19:35 +02:00
Peter Simons 9de1461f45 haskell-stm: update overrides for the new 2.5.x version 2018-09-24 21:19:35 +02:00
Peter Simons 21dc7a6aa5 haskell-text: update overrides for the new version 2018-09-24 21:19:35 +02:00
Peter Simons 9e963c020e haskell-stm: update overrides for the new 2.5.x version 2018-09-24 21:19:34 +02:00
Peter Simons dbffdee9d2 Add a couple of overrides to fix build with GHC 8.6.1. 2018-09-24 21:19:34 +02:00
Peter Simons 89972ff45f all-cabal-hashes: update snapshot to Hackage at 2018-09-18T11:13:20Z 2018-09-24 21:19:34 +02:00
Peter Simons c50365ec92 hackage-packages.nix: automatic Haskell package set update
This update was generated by hackage2nix v2.11.1 from Hackage revision
https://github.com/commercialhaskell/all-cabal-hashes/commit/be1e8a29d299be9e024a031a685db5b7fa702c38.
2018-09-24 21:19:29 +02:00
Peter Simons 2fc9fee6b2 hackage2nix: disable broken Hydra builds 2018-09-24 21:18:51 +02:00
Florian Klink 18c7fbd78d pythonPackages.elasticsearch-dsl: 0.0.9 -> 6.2.1 2018-09-24 21:08:31 +02:00
Domen Kožar 6eacc17157 nixos tests: move common configuration into separate file
This allows tests outside nixos to use acme setup.
2018-09-24 20:07:33 +01:00
R. RyanTMandEdward Tjörnhammar f37b39d279 jackett: 0.10.160 -> 0.10.198
Semi-automatic update generated by
https://github.com/ryantm/nixpkgs-update tools. This update was made
based on information from
https://repology.org/metapackage/jackett/versions
2018-09-24 20:40:29 +02:00
Jörg ThalheimandGitHub d123b30ed1 Merge pull request #47279 from asymmetric/asymmetric/remove-dapptools
Remove DappHub projects
2018-09-24 18:49:18 +01:00
Jörg ThalheimandGitHub 82e739a003 Merge pull request #47221 from Mic92/vim-additional-nix-code
vim: remove legacy additional-nix-code
2018-09-24 18:48:17 +01:00
Maximilian Boschandxeji 2babfb5a88 eztrace: 1.0.6 -> 1.1-7 (#47282)
See https://hydra.nixos.org/build/80721509
Addresses #45960
2018-09-24 19:34:35 +02:00
Lorenzo Manacorda 6017c6fa5b *: remove DappHub projects
DappHub maintains a separate overlay at
https://github.com/dapphub/dapptools/blob/master/overlay.nix
2018-09-24 19:24:06 +02:00
José Romildo Malaquiasandxeji 7cd824116a shades-of-gray-theme: init at 1.1.1 (#47280) 2018-09-24 19:22:56 +02:00
xejiandGitHub 9163c057e7 Merge pull request #47155 from xeji/p/installer-tests
nixos/tests/installer: prevent race between parted and udev
2018-09-24 18:59:50 +02:00
Will DietzandGitHub 2da6f215d3 Merge pull request #47281 from dtzWill/fix/llvm7-musl-rebase
llvm7: update sanitizer patch to fix w/musl
2018-09-24 11:49:56 -05:00
Andrew Dunhamandxeji ba278c3b87 boost: limit concurrent jobs to the maximum supported number (#47255) 2018-09-24 18:21:16 +02:00
Will Dietz 5b2de5126d llvm7: update musl patch for sanitizers 2018-09-24 11:19:05 -05:00
Will Dietz 3bd0e50a28 libpfm: don't use -Werror 2018-09-24 11:19:04 -05:00
Jörg ThalheimandGitHub e10361b30a Merge pull request #47275 from dtzWill/fix/iputils-musl
iputils: upstream fixes for musl
2018-09-24 17:16:30 +01:00
Andreas RammholdandGitHub 24c58bd1cc Merge pull request #47257 from taku0/firefox-bin-62.0.2
firefox, firefox-bin:: 61.0.2 -> 62.0.2,  firefox-esr: 60.2.0esr -> 60.2.1esr [Moderate security fixes]
2018-09-24 17:54:26 +02:00
Elis Hirwingandxeji 4406745ab4 testssl: 2.9.5-6 -> 2.9.5-7 (#47274)
Changelog: https://github.com/drwetter/testssl.sh/releases/tag/v2.9.5-7
2018-09-24 17:40:24 +02:00
xejiandGitHub c525111133 nixos/tests/hound: fix non-deterministic failure (#47152)
The test failed on Hydra in one instance because a request to the
server was sent before indexing was finished.
Retry the request until it succeeds (or times out).
2018-09-24 17:31:46 +02:00
R. RyanTMandxeji fe287e755f mixxx: 2.1.3 -> 2.1.4 (#47012)
Semi-automatic update generated by
https://github.com/ryantm/nixpkgs-update tools. This update was made
based on information from
https://repology.org/metapackage/mixxx/versions
2018-09-24 17:23:58 +02:00
xejiandGitHub 0166be71f6 Merge pull request #47040 from r-ryantm/auto-update/jdupes
jdupes: 1.10.2 -> 1.10.4
2018-09-24 17:22:05 +02:00
R. RyanTMandxeji cb4eb106e4 eid-mw: 4.4.3 -> 4.4.7 (#47076)
Semi-automatic update generated by
https://github.com/ryantm/nixpkgs-update tools. This update was made
based on information from
https://repology.org/metapackage/eid-mw/versions
2018-09-24 17:20:55 +02:00
Will Dietz d84c6bec29 iputils: upstream fixes for musl 2018-09-24 10:19:01 -05:00
Edward Tjörnhammar 491a580716 pythonPackages.sharedmem: init at 0.3.5 2018-09-24 17:00:55 +02:00
Edward Tjörnhammar f9c4a74b73 jetbrains.pycharm-professional: 2018.2.3 -> 2018.2.4 2018-09-24 16:39:40 +02:00
Edward Tjörnhammar feb57bc9b9 jetbrains.pycharm-community: 2018.2.3 -> 2018.2.4 2018-09-24 16:39:11 +02:00
Edward Tjörnhammar 546dfb51a6 jetbrains.goland: 2018.2.2 -> 2018.2.3 2018-09-24 16:38:35 +02:00
Edward Tjörnhammar 8ab4cbdac3 nixos: initrd/luks: make uuid specified devices discoverable 2018-09-24 16:35:46 +02:00
Edmund WuandEdward Tjörnhammar 4b1e3376d1 jetbrains.webstorm: 2018.2.2 -> 2018.2.3 2018-09-24 16:35:17 +02:00
Edmund WuandEdward Tjörnhammar 9b69a2520a jetbrains.ruby-mine: 2018.2.1 -> 2018.2.2 2018-09-24 16:35:17 +02:00
Edmund WuandEdward Tjörnhammar 88692dd376 jetbrains.rider: 2018.2 -> 2018.2.3 2018-09-24 16:35:17 +02:00
Edmund WuandEdward Tjörnhammar 3bc77e5977 jetbrains.pycharm-professional: 2018.2.2 -> 2018.2.3 2018-09-24 16:35:17 +02:00
Edmund WuandEdward Tjörnhammar b30e64bb8a jetbrains.pycharm-community: 2018.2.2 -> 2018.2.3 2018-09-24 16:35:17 +02:00
Edmund WuandEdward Tjörnhammar 6f78c882da jetbrains.phpstorm: 2018.2.2 -> 2018.2.3 2018-09-24 16:35:17 +02:00
Edmund WuandEdward Tjörnhammar 7ce6836e95 jetbrains.idea-ultimate: 2018.2.2 -> 2018.2.4 2018-09-24 16:35:17 +02:00
Edmund WuandEdward Tjörnhammar e2ff1bceb3 jetbrains.idea-community: 2018.2.2 -> 2018.2.4 2018-09-24 16:35:17 +02:00
Edmund WuandEdward Tjörnhammar 397215b8b6 jetbrains.goland: 2018.2.1 -> 2018.2.2 2018-09-24 16:35:17 +02:00
Edmund WuandEdward Tjörnhammar 0174f259ac jetbrains.datagrip: 2018.2.2 -> 2018.2.4 2018-09-24 16:35:17 +02:00