mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
commit
1c4b1018a3
@ -5,7 +5,6 @@
|
||||
callPackage,
|
||||
closureInfo,
|
||||
coreutils,
|
||||
docker,
|
||||
e2fsprogs,
|
||||
fakeroot,
|
||||
findutils,
|
||||
@ -17,6 +16,7 @@
|
||||
moreutils,
|
||||
nix,
|
||||
pigz,
|
||||
pkgs,
|
||||
rsync,
|
||||
runCommand,
|
||||
runtimeShell,
|
||||
@ -123,24 +123,7 @@ rec {
|
||||
|
||||
# We need to sum layer.tar, not a directory, hence tarsum instead of nix-hash.
|
||||
# And we cannot untar it, because then we cannot preserve permissions etc.
|
||||
tarsum = runCommand "tarsum" {
|
||||
nativeBuildInputs = [ go ];
|
||||
} ''
|
||||
mkdir tarsum
|
||||
cd tarsum
|
||||
|
||||
cp ${./tarsum.go} tarsum.go
|
||||
export GOPATH=$(pwd)
|
||||
export GOCACHE="$TMPDIR/go-cache"
|
||||
export GO111MODULE=off
|
||||
mkdir -p src/github.com/docker/docker/pkg
|
||||
ln -sT ${docker.moby-src}/pkg/tarsum src/github.com/docker/docker/pkg/tarsum
|
||||
go build
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
||||
cp tarsum $out/bin/
|
||||
'';
|
||||
tarsum = pkgs.tarsum;
|
||||
|
||||
# buildEnv creates symlinks to dirs, which is hard to edit inside the overlay VM
|
||||
mergeDrvs = {
|
||||
|
42
pkgs/build-support/docker/tarsum.nix
Normal file
42
pkgs/build-support/docker/tarsum.nix
Normal file
@ -0,0 +1,42 @@
|
||||
{ stdenv, go, docker, nixosTests }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "tarsum";
|
||||
|
||||
nativeBuildInputs = [ go ];
|
||||
disallowedReferences = [ go ];
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
CGO_ENABLED = 0;
|
||||
GOFLAGS = "-trimpath";
|
||||
GO111MODULE = "off";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
mkdir tarsum
|
||||
cd tarsum
|
||||
cp ${./tarsum.go} tarsum.go
|
||||
export GOPATH=$(pwd)
|
||||
export GOCACHE="$TMPDIR/go-cache"
|
||||
mkdir -p src/github.com/docker/docker/pkg
|
||||
ln -sT ${docker.moby-src}/pkg/tarsum src/github.com/docker/docker/pkg/tarsum
|
||||
go build
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
cp tarsum $out/bin/
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
tests = {
|
||||
dockerTools = nixosTests.docker-tools;
|
||||
};
|
||||
};
|
||||
|
||||
meta.platforms = go.meta.platforms;
|
||||
}
|
@ -369,6 +369,7 @@ in
|
||||
dockerTools = callPackage ../build-support/docker {
|
||||
writePython3 = buildPackages.writers.writePython3;
|
||||
};
|
||||
tarsum = callPackage ../build-support/docker/tarsum.nix { };
|
||||
|
||||
snapTools = callPackage ../build-support/snap { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user