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