2021-01-25 08:26:54 +00:00
|
|
|
{ lib
|
2020-01-02 17:51:45 +00:00
|
|
|
, buildGoPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
}:
|
|
|
|
|
2020-02-29 09:20:00 +00:00
|
|
|
buildGoPackage rec {
|
2020-01-02 17:51:45 +00:00
|
|
|
pname = "docker-slim";
|
2021-04-15 04:20:00 +00:00
|
|
|
version = "1.35.0";
|
2020-01-02 17:51:45 +00:00
|
|
|
|
|
|
|
goPackagePath = "github.com/docker-slim/docker-slim";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker-slim";
|
|
|
|
repo = "docker-slim";
|
2020-02-29 09:20:00 +00:00
|
|
|
rev = version;
|
2021-04-15 04:20:00 +00:00
|
|
|
sha256 = "0j350rhyav844vhaa1f5idffflgs5h3c5zcazly9s5sf4invm49y";
|
2020-01-02 17:51:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
subPackages = [ "cmd/docker-slim" "cmd/docker-slim-sensor" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
2020-02-29 09:20:00 +00:00
|
|
|
buildFlagsArray = [
|
|
|
|
''-ldflags=
|
|
|
|
-s -w -X ${goPackagePath}/pkg/version.appVersionTag=${version}
|
|
|
|
-X ${goPackagePath}/pkg/version.appVersionRev=${src.rev}
|
|
|
|
''
|
|
|
|
];
|
2020-01-02 17:51:45 +00: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 01:50:57 +00:00
|
|
|
wrapProgram "$out/bin/docker-slim" --add-flags '--state-path "$(pwd)"'
|
2020-01-02 17:51:45 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-01-02 17:51:45 +00:00
|
|
|
description = "Minify and secure Docker containers";
|
|
|
|
homepage = "https://dockersl.im/";
|
2020-12-15 18:45:00 +00:00
|
|
|
changelog = "https://github.com/docker-slim/docker-slim/blob/${version}/CHANGELOG.md";
|
2020-01-02 17:51:45 +00:00
|
|
|
license = licenses.asl20;
|
2020-11-17 11:02:06 +00:00
|
|
|
maintainers = with maintainers; [ Br1ght0ne marsam mbrgm ];
|
2020-01-02 17:51:45 +00:00
|
|
|
};
|
|
|
|
}
|