docker: allow overriding package inputs per docker package

Previously we could not override the input packages to docker at all as
that had been shadowed due to the usage of inherit in all-package.nix.

We are now mixing the "variable" variables for the build and the
dependency declarations for the package and using callPackage as if each
of the docker packages would be separate files that we evaluate.

This now enables overriding e.g. iptables for a single verison of
docker which previously was not feasible without importing the
default.nix again (and passing different arguments).

> pkgs.docker.override { iptables = pkgs.iptables-nftables-compat; }
This commit is contained in:
Andreas Rammhold 2021-01-26 13:01:50 +01:00
parent 13a6565c4c
commit ed46383416

View File

@ -1,12 +1,4 @@
{ stdenv, lib, fetchFromGitHub, fetchpatch, buildGoPackage { lib, callPackage }:
, makeWrapper, installShellFiles, pkg-config
, go-md2man, go, containerd, runc, docker-proxy, tini, libtool
, sqlite, iproute, lvm2, systemd, docker-buildx
, btrfs-progs, iptables, e2fsprogs, xz, util-linux, xfsprogs, git
, procps, libseccomp
, nixosTests
, buildxSupport ? false
}:
with lib; with lib;
@ -16,8 +8,16 @@ rec {
, mobyRev, mobySha256 , mobyRev, mobySha256
, runcRev, runcSha256 , runcRev, runcSha256
, containerdRev, containerdSha256 , containerdRev, containerdSha256
, tiniRev, tiniSha256, buildxSupport , tiniRev, tiniSha256, buildxSupport ? false
} : # package dependencies
, stdenv, fetchFromGitHub, fetchpatch, buildGoPackage
, makeWrapper, installShellFiles, pkg-config
, go-md2man, go, containerd, runc, docker-proxy, tini, libtool
, sqlite, iproute, lvm2, systemd, docker-buildx
, btrfs-progs, iptables, e2fsprogs, xz, util-linux, xfsprogs, git
, procps, libseccomp
, nixosTests
}:
let let
docker-runc = runc.overrideAttrs (oldAttrs: { docker-runc = runc.overrideAttrs (oldAttrs: {
name = "docker-runc-${version}"; name = "docker-runc-${version}";
@ -215,7 +215,7 @@ rec {
# Get revisions from # Get revisions from
# https://github.com/moby/moby/tree/${version}/hack/dockerfile/install/* # https://github.com/moby/moby/tree/${version}/hack/dockerfile/install/*
docker_20_10 = makeOverridable dockerGen rec { docker_20_10 = callPackage dockerGen rec {
version = "20.10.2"; version = "20.10.2";
rev = "v${version}"; rev = "v${version}";
sha256 = "0z0hpm5hrqh7p8my8lmiwpym2shs48my6p0zv2cc34wym0hcly51"; sha256 = "0z0hpm5hrqh7p8my8lmiwpym2shs48my6p0zv2cc34wym0hcly51";
@ -227,6 +227,5 @@ rec {
containerdSha256 = "09xvhjg5f8h90w1y94kqqnqzhbhd62dcdd9wb9sdqakisjk6zrl0"; containerdSha256 = "09xvhjg5f8h90w1y94kqqnqzhbhd62dcdd9wb9sdqakisjk6zrl0";
tiniRev = "de40ad007797e0dcd8b7126f27bb87401d224240"; # v0.19.0 tiniRev = "de40ad007797e0dcd8b7126f27bb87401d224240"; # v0.19.0
tiniSha256 = "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn"; tiniSha256 = "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn";
inherit buildxSupport;
}; };
} }