2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildGoPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoPackage rec {
|
|
|
|
pname = "docker-slim";
|
2021-08-08 23:34:03 +00:00
|
|
|
version = "1.36.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
goPackagePath = "github.com/docker-slim/docker-slim";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "docker-slim";
|
|
|
|
repo = "docker-slim";
|
|
|
|
rev = version;
|
2021-08-08 23:34:03 +00:00
|
|
|
sha256 = "sha256-Q8M8+krPC6WRDCxe88gzX5bDG8x6sJ8TduTKjA85WFA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
subPackages = [ "cmd/docker-slim" "cmd/docker-slim-sensor" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s" "-w"
|
|
|
|
"-X ${goPackagePath}/pkg/version.appVersionTag=${version}"
|
|
|
|
"-X ${goPackagePath}/pkg/version.appVersionRev=${src.rev}"
|
2020-04-24 23:36:52 +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-05-15 21:57:56 +00:00
|
|
|
wrapProgram "$out/bin/docker-slim" --add-flags '--state-path "$(pwd)"'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Minify and secure Docker containers";
|
|
|
|
homepage = "https://dockersl.im/";
|
2020-12-25 13:55:36 +00:00
|
|
|
changelog = "https://github.com/docker-slim/docker-slim/blob/${version}/CHANGELOG.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2020-11-19 00:13:47 +00:00
|
|
|
maintainers = with maintainers; [ Br1ght0ne marsam mbrgm ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|