about summary refs log tree commit diff
path: root/pkgs/by-name/st/sttr/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/st/sttr/package.nix')
-rw-r--r--pkgs/by-name/st/sttr/package.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/by-name/st/sttr/package.nix b/pkgs/by-name/st/sttr/package.nix
new file mode 100644
index 000000000000..bc0c3a419a88
--- /dev/null
+++ b/pkgs/by-name/st/sttr/package.nix
@@ -0,0 +1,43 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, installShellFiles
+}:
+
+buildGoModule rec {
+  pname = "sttr";
+  version = "0.2.18";
+
+  src = fetchFromGitHub {
+    owner = "abhimanyu003";
+    repo = "sttr";
+    rev = "v${version}";
+    hash = "sha256-zZ9zrKUbrRaYQrlUtjOZLfEuiaqp/yyXpOlDspBJbSQ=";
+  };
+
+  vendorHash = "sha256-io56WqF3cAyNK7Auhdq2iB26B6wjcVnq9cr3NS/4Z0w=";
+
+  nativeBuildInputs = [ installShellFiles ];
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X=main.version=${version}"
+  ];
+
+  postInstall = ''
+    installShellCompletion --cmd sttr \
+      --bash <($out/bin/sttr completion bash) \
+      --fish <($out/bin/sttr completion fish) \
+      --zsh <($out/bin/sttr completion zsh)
+  '';
+
+  meta = with lib; {
+    description = "Cross-platform cli tool to perform various operations on string";
+    homepage = "https://github.com/abhimanyu003/sttr";
+    changelog = "https://github.com/abhimanyu003/sttr/releases/tag/v${version}";
+    license = licenses.mit;
+    maintainers = with maintainers; [ Ligthiago ];
+    mainProgram = "sttr";
+  };
+}