git.iko.soy/typeable/nixpkgs
on master help sign in
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; }

commited46383416a21ef496c6b52bc89d80f28c2efcad authorAndreas Rammhold <andreas@rammhold.de> dateTue 26 Jan 2021, 13:01 (6 years ago) parent13a6565
1 file changed+12−13
pkgs/applications/virtualization/docker/default.nix+12−13
pkgs/applications/virtualization/docker/default.nix+12−13
@@ -1,12 +1,4 @@
1−{ stdenv, lib, fetchFromGitHub, fetchpatch, buildGoPackage
2−, makeWrapper, installShellFiles, pkg-config
3−, go-md2man, go, containerd, runc, docker-proxy, tini, libtool
4−, sqlite, iproute, lvm2, systemd, docker-buildx
5−, btrfs-progs, iptables, e2fsprogs, xz, util-linux, xfsprogs, git
6−, procps, libseccomp
7−, nixosTests
8−, buildxSupport ? false
9−}:
1+{ lib, callPackage }:
102
113with lib;
124
@@ -16,8 +8,16 @@ rec {
168 , mobyRev, mobySha256
179 , runcRev, runcSha256
1810 , containerdRev, containerdSha256
19− , tiniRev, tiniSha256, buildxSupport
20− } :
11+ , tiniRev, tiniSha256, buildxSupport ? false
12+ # package dependencies
13+ , stdenv, fetchFromGitHub, fetchpatch, buildGoPackage
14+ , makeWrapper, installShellFiles, pkg-config
15+ , go-md2man, go, containerd, runc, docker-proxy, tini, libtool
16+ , sqlite, iproute, lvm2, systemd, docker-buildx
17+ , btrfs-progs, iptables, e2fsprogs, xz, util-linux, xfsprogs, git
18+ , procps, libseccomp
19+ , nixosTests
20+ }:
2121 let
2222 docker-runc = runc.overrideAttrs (oldAttrs: {
2323 name = "docker-runc-${version}";
@@ -215,7 +215,7 @@ rec {
215215
216216 # Get revisions from
217217 # https://github.com/moby/moby/tree/${version}/hack/dockerfile/install/*
218− docker_20_10 = makeOverridable dockerGen rec {
218+ docker_20_10 = callPackage dockerGen rec {
219219 version = "20.10.2";
220220 rev = "v${version}";
221221 sha256 = "0z0hpm5hrqh7p8my8lmiwpym2shs48my6p0zv2cc34wym0hcly51";
@@ -227,6 +227,5 @@ rec {
227227 containerdSha256 = "09xvhjg5f8h90w1y94kqqnqzhbhd62dcdd9wb9sdqakisjk6zrl0";
228228 tiniRev = "de40ad007797e0dcd8b7126f27bb87401d224240"; # v0.19.0
229229 tiniSha256 = "1h20i3wwlbd8x4jr2gz68hgklh0lb0jj7y5xk1wvr8y58fip1rdn";
230− inherit buildxSupport;
231230 };
232231}