2023-09-21 13:09:15 +02:00
{ pkgs , lib , buildGoModule , fetchFromGitHub }:
# TODO: `docker pushrm` does not work, however `docker-pushrm` does.
2024-02-04 15:02:12 +01:00
# TODO: Watch for new releases
2023-09-21 13:09:15 +02:00
# docker-compose plugin: https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/docker/compose.nix
buildGoModule rec {
pname = " d o c k e r - p u s h r m " ;
version = " 1 . 9 . 0 " ;
src = fetchFromGitHub {
owner = " c h r i s t i a n - k o r n e c k " ;
repo = " d o c k e r - p u s h r m " ;
rev = " v ${ version } " ;
# To get the hash, set its value to "" and start a build.
# https://nixos.org/manual/nixpkgs/stable/#sec-source-hashes
hash = " s h a 2 5 6 - c a Q o I 0 P 4 o M o T a m K L n z 2 N E / B 9 y p 3 N X u p n T X i 4 k 4 Z b s 6 s = " ;
} ;
# To get the hash, set its value to "" and start a build.
# https://nixos.org/manual/nixpkgs/stable/#sec-source-hashes
vendorHash = " s h a 2 5 6 - Z w P W 6 p O z U B Y W i t U B M W 5 9 D r r P Z d T D A g C i N 0 4 M d Q Y v X 0 U = " ;
# docker-sbom plugin: https://github.com/NixOS/nixpkgs/blob/50491a3493d365abd88ab08124cfc1be9f29ea42/pkgs/applications/virtualization/docker/sbom.nix#L26
#nativeBuildInputs = with pkgs; [ docker ];
# To reduce the size of the resulting binary, you can strip off information not needed during execution. Using -ldflags followed by -s -w flags makes the resulting binary slightly lighter.
# https://opensource.com/article/22/4/go-build-options
ldflags = [ " - s " " - w " ] ;
installPhase = ''
runHook preInstall
install - Dm0777 $ GOPATH/bin/docker-pushrm $ out/libexec/docker/cli-plugins/docker-pushrm
mkdir - p $ out/bin
ln - s $ out/libexec/docker/cli-plugins/docker-pushrm $ out/bin/docker-pushrm
runHook postInstall
'' ;
meta = with lib ; {
description = " ' D o c k e r P u s h R e a d m e ' - a D o c k e r C L I p l u g i n t o u p d a t e c o n t a i n e r r e p o d o c s " ;
lonDescription = ''
docker-pushrm is a Docker CLI plugin that adds a new docker pushrm ( speak : " p u s h r e a d m e " ) command to Docker .
It pushes the README file from the current working directory to a container registry server where it appears as repo description in the webinterface .
It currently supports Dockerhub ( cloud ) , Red Hat Quay ( cloud and self-hosted/OpenShift ) and Harbor v2 ( self-hosted ) .
For most registry types docker-pushrm uses authentication info from the Docker credentials store - so it " j u s t w o r k s " for registry servers that you're already logged into with Docker .
( For some other registry types , you'll need to pass an API key via env var or config file ) .
'' ;
homepage = " h t t p s : / / g i t h u b . c o m / c h r i s t i a n - k o r n e c k / d o c k e r - p u s h r m " ;
license = licenses . mit ;
maintainers = with maintainers ; [ langbeindaniel ] ;
} ;
}