docker: remove with lib

This commit is contained in:
Sandro Jäckel 2022-11-22 23:12:55 +01:00
parent ffcfa322b9
commit ac45880256

View File

@ -1,7 +1,5 @@
{ lib, callPackage, fetchFromGitHub }: { lib, callPackage, fetchFromGitHub }:
with lib;
rec { rec {
dockerGen = { dockerGen = {
version, rev, sha256 version, rev, sha256
@ -72,7 +70,7 @@ rec {
NIX_CFLAGS_COMPILE = "-DMINIMAL=ON"; NIX_CFLAGS_COMPILE = "-DMINIMAL=ON";
}); });
moby = buildGoPackage (optionalAttrs stdenv.isLinux rec { moby = buildGoPackage (lib.optionalAttrs stdenv.isLinux rec {
pname = "moby"; pname = "moby";
inherit version; inherit version;
@ -87,9 +85,9 @@ rec {
++ lib.optional withSystemd systemd ++ lib.optional withSystemd systemd
++ lib.optional withSeccomp libseccomp; ++ lib.optional withSeccomp libseccomp;
extraPath = optionals stdenv.isLinux (makeBinPath [ iproute2 iptables e2fsprogs xz xfsprogs procps util-linux git ]); extraPath = lib.optionals stdenv.isLinux (lib.makeBinPath [ iproute2 iptables e2fsprogs xz xfsprogs procps util-linux git ]);
extraUserPath = optionals (stdenv.isLinux && !clientOnly) (makeBinPath [ rootlesskit slirp4netns fuse-overlayfs ]); extraUserPath = lib.optionals (stdenv.isLinux && !clientOnly) (lib.makeBinPath [ rootlesskit slirp4netns fuse-overlayfs ]);
patches = [ patches = [
# This patch incorporates code from a PR fixing using buildkit with the ZFS graph driver. # This patch incorporates code from a PR fixing using buildkit with the ZFS graph driver.
@ -150,7 +148,7 @@ rec {
++ lib.optional composeSupport docker-compose; ++ lib.optional composeSupport docker-compose;
pluginsRef = symlinkJoin { name = "docker-plugins"; paths = plugins; }; pluginsRef = symlinkJoin { name = "docker-plugins"; paths = plugins; };
in in
buildGoPackage (optionalAttrs (!clientOnly) { buildGoPackage (lib.optionalAttrs (!clientOnly) {
# allow overrides of docker components # allow overrides of docker components
# TODO: move packages out of the let...in into top-level to allow proper overrides # TODO: move packages out of the let...in into top-level to allow proper overrides
inherit docker-runc docker-containerd docker-proxy docker-tini moby; inherit docker-runc docker-containerd docker-proxy docker-tini moby;
@ -180,7 +178,7 @@ rec {
postPatch = '' postPatch = ''
patchShebangs man scripts/build/ patchShebangs man scripts/build/
substituteInPlace ./scripts/build/.variables --replace "set -eu" "" substituteInPlace ./scripts/build/.variables --replace "set -eu" ""
'' + optionalString (plugins != []) '' '' + lib.optionalString (plugins != []) ''
substituteInPlace ./cli-plugins/manager/manager_unix.go --replace /usr/libexec/docker/cli-plugins \ substituteInPlace ./cli-plugins/manager/manager_unix.go --replace /usr/libexec/docker/cli-plugins \
"${pluginsRef}/libexec/docker/cli-plugins" "${pluginsRef}/libexec/docker/cli-plugins"
''; '';
@ -211,7 +209,7 @@ rec {
makeWrapper $out/libexec/docker/docker $out/bin/docker \ makeWrapper $out/libexec/docker/docker $out/bin/docker \
--prefix PATH : "$out/libexec/docker:$extraPath" --prefix PATH : "$out/libexec/docker:$extraPath"
'' + optionalString (!clientOnly) '' '' + lib.optionalString (!clientOnly) ''
# symlink docker daemon to docker cli derivation # symlink docker daemon to docker cli derivation
ln -s ${moby}/bin/dockerd $out/bin/dockerd ln -s ${moby}/bin/dockerd $out/bin/dockerd
ln -s ${moby}/bin/dockerd-rootless $out/bin/dockerd-rootless ln -s ${moby}/bin/dockerd-rootless $out/bin/dockerd-rootless
@ -241,7 +239,7 @@ rec {
passthru.tests = lib.optionals (!clientOnly) { inherit (nixosTests) docker; }; passthru.tests = lib.optionals (!clientOnly) { inherit (nixosTests) docker; };
meta = { meta = with lib; {
homepage = "https://www.docker.com/"; homepage = "https://www.docker.com/";
description = "An open source project to pack, ship and run any application as a lightweight container"; description = "An open source project to pack, ship and run any application as a lightweight container";
license = licenses.asl20; license = licenses.asl20;