2021-01-25 09:26:54 +01:00
|
|
|
{ lib
|
2020-01-02 18:51:45 +01:00
|
|
|
, buildGoPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
}:
|
|
|
|
|
2020-02-29 10:20:00 +01:00
|
|
|
buildGoPackage rec {
|
2020-01-02 18:51:45 +01:00
|
|
|
pname = "docker-slim";
|
2021-04-15 06:20:00 +02:00
|
|
|
version = "1.35.0";
|
2020-01-02 18:51:45 +01:00
|
|
|
|
|
|
|
goPackagePath = "github.com/docker-slim/docker-slim";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker-slim";
|
|
|
|
repo = "docker-slim";
|
2020-02-29 10:20:00 +01:00
|
|
|
rev = version;
|
2021-04-15 06:20:00 +02:00
|
|
|
sha256 = "0j350rhyav844vhaa1f5idffflgs5h3c5zcazly9s5sf4invm49y";
|
2020-01-02 18:51:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
subPackages = [ "cmd/docker-slim" "cmd/docker-slim-sensor" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
2020-02-29 10:20:00 +01:00
|
|
|
buildFlagsArray = [
|
|
|
|
''-ldflags=
|
|
|
|
-s -w -X ${goPackagePath}/pkg/version.appVersionTag=${version}
|
|
|
|
-X ${goPackagePath}/pkg/version.appVersionRev=${src.rev}
|
|
|
|
''
|
|
|
|
];
|
2020-01-02 18:51:45 +01:00
|
|
|
|
|
|
|
# docker-slim tries to create its state dir next to the binary (inside the nix
|
|
|
|
# store), so we set it to use the working directory at the time of invocation
|
|
|
|
postInstall = ''
|
2020-04-28 03:50:57 +02:00
|
|
|
wrapProgram "$out/bin/docker-slim" --add-flags '--state-path "$(pwd)"'
|
2020-01-02 18:51:45 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-01-02 18:51:45 +01:00
|
|
|
description = "Minify and secure Docker containers";
|
|
|
|
homepage = "https://dockersl.im/";
|
2020-12-15 19:45:00 +01:00
|
|
|
changelog = "https://github.com/docker-slim/docker-slim/blob/${version}/CHANGELOG.md";
|
2020-01-02 18:51:45 +01:00
|
|
|
license = licenses.asl20;
|
2020-11-17 12:02:06 +01:00
|
|
|
maintainers = with maintainers; [ Br1ght0ne marsam mbrgm ];
|
2020-01-02 18:51:45 +01:00
|
|
|
};
|
|
|
|
}
|