anchor.diff:        ++ optional (devicemapper == null) "exclude_graphdriver_devicemapper"
         ++ optional (libseccomp != null) "seccomp";
   
  -    buildPhase = ''
  +   }) // rec {
  +    inherit version rev;
  +
  +    name = "docker-${version}";
  +
  +    src = fetchFromGitHub {
  +      owner = "docker";
  +      repo = "docker-ce";
  +      rev = "v${version}";
  +      sha256 = sha256;
  +    };
  +
  +    # Optimizations break compilation of libseccomp c bindings
  +    hardeningDisable = [ "fortify" ];
  +
  +    nativeBuildInputs = [ pkgconfig ];
  +    buildInputs = [
  +      makeWrapper removeReferencesTo go-md2man go libtool
  +    ] ++ optionals (stdenv.isLinux) [
  +      sqlite devicemapper btrfs-progs systemd libtool libseccomp
  +    ];
  +
  +    dontStrip = true;
  +
  +    buildPhase = (optionalString (stdenv.isLinux) ''
         # build engine
         cd ./components/engine
         export AUTO_GOPATH=1
         export DOCKER_GITCOMMIT="${rev}"
         ./hack/make.sh dynbinary
         cd -
  -
  +    '') + ''
         # build cli
         cd ./components/cli
         # Mimic AUTO_GOPATH
  
positive.code: 
      # systemd 230 no longer has libsystemd-journal as a separate entity from libsystemd
      patchPhase = ''
        patchShebangs .
        substituteInPlace ./components/engine/hack/make.sh                   --replace libsystemd-journal libsystemd
        substituteInPlace ./components/engine/daemon/logger/journald/read.go --replace libsystemd-journal libsystemd
        substituteInPlace ./components/cli/scripts/build/.variables --replace "set -eu" ""
       '';
  
      outputs = ["out" "man"];
  
      extraPath = makeBinPath [ iproute iptables e2fsprogs xz xfsprogs procps utillinux ];
  
      installPhase = ''
        install -Dm755 ./components/cli/docker $out/libexec/docker/docker
  
        if [ -d "./components/engine/bundles/${version}" ]; then
          install -Dm755 ./components/engine/bundles/${version}/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
        else
          install -Dm755 ./components/engine/bundles/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
        fi
  
        makeWrapper $out/libexec/docker/docker $out/bin/docker \
          --prefix PATH : "$out/libexec/docker:$extraPath"
        makeWrapper $out/libexec/docker/dockerd $out/bin/dockerd \
          --prefix PATH : "$out/libexec/docker:$extraPath"
  
  
negative.code: 
        # systemd
        install -Dm644 ./components/engine/contrib/init/systemd/docker.service $out/etc/systemd/system/docker.service
      '' + ''
        install -Dm755 ./components/cli/docker $out/libexec/docker/docker
  
        makeWrapper $out/libexec/docker/docker $out/bin/docker \
          --prefix PATH : "$out/libexec/docker:$extraPath"
  
        # completion (cli)
        install -Dm644 ./components/cli/contrib/completion/bash/docker $out/share/bash-completion/completions/docker
  