2023-02-02 18:25:31 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, makeBinaryWrapper }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "docker-slim";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "1.40.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-02-02 18:25:31 +00:00
|
|
|
owner = "slimtoolkit";
|
|
|
|
repo = "slim";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = version;
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-A5qMg+mgcvK0YyJLbnFdZRS3s+OFWFaLKmnyvKj4r4g=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
vendorHash = null;
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
subPackages = [ "cmd/slim" "cmd/slim-sensor" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeBuildInputs = [ makeBinaryWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
preBuild = ''
|
|
|
|
go generate github.com/docker-slim/docker-slim/pkg/appbom
|
|
|
|
'';
|
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
ldflags = [
|
2022-06-16 17:23:12 +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-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 = ''
|
2023-02-02 18:25:31 +00:00
|
|
|
wrapProgram "$out/bin/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";
|
2023-02-02 18:25:31 +00:00
|
|
|
homepage = "https://slimtoolkit.org/";
|
|
|
|
changelog = "https://github.com/slimtoolkit/slim/raw/${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
|
|
|
};
|
|
|
|
}
|