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-12-12 04:20:00 +00:00
|
|
|
version = "1.37.3";
|
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-12-12 04:20:00 +00:00
|
|
|
sha256 = "sha256-jzwQ3nrhLDiQXcVkPiXrRAmpLQOD8ILBnoCEUiEbxzw=";
|
2020-01-02 17:51:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
subPackages = [ "cmd/docker-slim" "cmd/docker-slim-sensor" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
2021-08-26 04:31:57 +01:00
|
|
|
ldflags = [
|
|
|
|
"-s" "-w"
|
|
|
|
"-X ${goPackagePath}/pkg/version.appVersionTag=${version}"
|
|
|
|
"-X ${goPackagePath}/pkg/version.appVersionRev=${src.rev}"
|
2020-02-29 09:20:00 +00:00
|
|
|
];
|
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 02:50:57 +01: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/";
|
2021-09-08 00:00:00 +01:00
|
|
|
changelog = "https://github.com/docker-slim/docker-slim/raw/${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
|
|
|
};
|
|
|
|
}
|