From ed46383416a21ef496c6b52bc89d80f28c2efcad Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Tue, 26 Jan 2021 13:01:50 +0100 Subject: [PATCH] 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; } --- .../virtualization/docker/default.nix | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/pkgs/applications/virtualization/docker/default.nix b/pkgs/applications/virtualization/docker/default.nix index e9496247f06d..207ebdf2211f 100644 --- a/pkgs/applications/virtualization/docker/default.nix +++ b/pkgs/applications/virtualization/docker/default.nix @@ -1,12 +1,4 @@ -{ stdenv, lib, 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 -, buildxSupport ? false -}: +{ lib, callPackage }: with lib; @@ -16,8 +8,16 @@ rec { , mobyRev, mobySha256 , runcRev, runcSha256 , 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 docker-runc = runc.overrideAttrs (oldAttrs: { name = "docker-runc-${version}"; @@ -215,7 +215,7 @@ rec { # Get revisions from # 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"; rev = "v${version}"; sha256 = "0z0hpm5hrqh7p8my8lmiwpym2shs48my6p0zv2cc34wym0hcly51"; @@ -227,6 +227,5 @@ rec { containerdSha256 = "09xvhjg5f8h90w1y94kqqnqzhbhd62dcdd9wb9sdqakisjk6zrl0"; tiniRev = "de40ad007797e0dcd8b7126f27bb87401d224240"; # v0.19.0 tiniSha256 = "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn"; - inherit buildxSupport; }; }