nix-git/modules/docker-pushrm-pkg.nix

54 lines
2.5 KiB
Nix
Raw Normal View History

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 = "docker-pushrm";
version = "1.9.0";
src = fetchFromGitHub {
owner = "christian-korneck";
repo = "docker-pushrm";
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 = "sha256-caQoI0P4oMoTamKLnz2NE/B9yp3NXupnTXi4k4Zbs6s=";
};
# To get the hash, set its value to "" and start a build.
# https://nixos.org/manual/nixpkgs/stable/#sec-source-hashes
vendorHash = "sha256-ZwPW6pOzUBYWitUBMW59DrrPZdTDAgCiN04MdQYvX0U=";
# 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 = "'Docker Push Readme' - a Docker CLI plugin to update container repo docs";
lonDescription = ''
docker-pushrm is a Docker CLI plugin that adds a new docker pushrm (speak: "push readme") 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 "just works" 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 = "https://github.com/christian-korneck/docker-pushrm";
license = licenses.mit;
maintainers = with maintainers; [ langbeindaniel ];
};
}