2023-01-27 04:20:00 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, makeBinaryWrapper }:
|
2020-01-02 17:51:45 +00:00
|
|
|
|
2022-06-04 14:19:08 +00:00
|
|
|
buildGoModule rec {
|
2020-01-02 17:51:45 +00:00
|
|
|
pname = "docker-slim";
|
2023-01-27 04:20:00 +00:00
|
|
|
version = "1.40.0";
|
2020-01-02 17:51:45 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-01-27 04:20:00 +00:00
|
|
|
owner = "slimtoolkit";
|
|
|
|
repo = "slim";
|
2020-02-29 09:20:00 +00:00
|
|
|
rev = version;
|
2023-01-27 04:20:00 +00:00
|
|
|
sha256 = "sha256-KbwkZIGkAdzPPo5CrWKnKzFsD8OUONk6JWo1wzwti3s=";
|
2020-01-02 17:51:45 +00:00
|
|
|
};
|
|
|
|
|
2022-06-04 14:19:08 +00:00
|
|
|
vendorSha256 = null;
|
|
|
|
|
2023-01-27 04:20:00 +00:00
|
|
|
subPackages = [ "cmd/slim" "cmd/slim-sensor" ];
|
2020-01-02 17:51:45 +00:00
|
|
|
|
2023-01-27 04:20:00 +00:00
|
|
|
nativeBuildInputs = [ makeBinaryWrapper ];
|
2020-01-02 17:51:45 +00:00
|
|
|
|
2021-08-26 03:31:57 +00:00
|
|
|
ldflags = [
|
2022-06-04 14:19:08 +00:00
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X github.com/docker-slim/docker-slim/pkg/version.appVersionTag=${version}"
|
|
|
|
"-X github.com/docker-slim/docker-slim/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 = ''
|
2023-01-27 04:20:00 +00:00
|
|
|
wrapProgram "$out/bin/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";
|
2023-01-27 04:20:00 +00:00
|
|
|
homepage = "https://slimtoolkit.org/";
|
|
|
|
changelog = "https://github.com/slimtoolkit/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
|
|
|
};
|
|
|
|
}
|