From 6e23095df7939ad63d739a1899a324d640e9d000 Mon Sep 17 00:00:00 2001 From: Sam Willcocks Date: Tue, 25 Feb 2025 17:24:18 +0000 Subject: [PATCH] lightningstream: init at 0.4.3 --- pkgs/by-name/li/lightningstream/package.nix | 69 +++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 pkgs/by-name/li/lightningstream/package.nix diff --git a/pkgs/by-name/li/lightningstream/package.nix b/pkgs/by-name/li/lightningstream/package.nix new file mode 100644 index 000000000000..94f19ca2d3c6 --- /dev/null +++ b/pkgs/by-name/li/lightningstream/package.nix @@ -0,0 +1,69 @@ +{ + lib, + stdenv, + buildGoModule, + fetchFromGitHub, + installShellFiles, + versionCheckHook, + nix-update-script, +}: +let + version = "0.4.3"; +in +buildGoModule { + pname = "lightningstream"; + inherit version; + + src = fetchFromGitHub { + owner = "PowerDNS"; + repo = "lightningstream"; + tag = "v${version}"; + hash = "sha256-gnLmqm35HHpQlglKjw57NBMs8jMAHDieWlnE3OAQR4I="; + }; + + ldflags = [ + "-s" + "-w" + "-X main.version=${version}" + ]; + + vendorHash = "sha256-wkLoaR46l+jCm3TJDflcuI2hDvluoH2o5lLIqtrVRqo="; + + nativeBuildInputs = [ installShellFiles ]; + + # Install shell completions so long as we can run the binary to do so. This means that + # when cross compiling we may not be able to generate shell completions. + # See https://github.com/NixOS/nixpkgs/issues/308283 + # + # Dummy config file is currently required to generate completions. This may be fixed + # upstream; see https://github.com/PowerDNS/lightningstream/issues/85 + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + cat < lightningstream.yaml + lmdbs: + dummy: + path: dummy + END + + installShellCompletion \ + --cmd lightningstream \ + --bash <($out/bin/lightningstream completion bash) \ + --fish <($out/bin/lightningstream completion fish) \ + --zsh <($out/bin/lightningstream completion zsh) + ''; + + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + versionCheckProgramArg = "--version"; + + passthru = { + updateScript = nix-update-script { }; + }; + + meta = { + description = "LMDB sync via S3 buckets"; + mainProgram = "lightningstream"; + license = lib.licenses.mit; + homepage = "https://doc.powerdns.com/lightningstream/latest/index.html"; + maintainers = with lib.maintainers; [ samw ]; + }; +}