about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/by-name/gt/gtrash/package.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/by-name/gt/gtrash/package.nix b/pkgs/by-name/gt/gtrash/package.nix
new file mode 100644
index 000000000000..aee737aa83df
--- /dev/null
+++ b/pkgs/by-name/gt/gtrash/package.nix
@@ -0,0 +1,51 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, installShellFiles
+}:
+
+buildGoModule rec {
+  pname = "gtrash";
+  version = "0.0.5";
+
+  src = fetchFromGitHub {
+    owner = "umlx5h";
+    repo = "gtrash";
+    rev = "v${version}";
+    hash = "sha256-5+wcrU2mx/ZawMCSCU4xddMlMVpoIW/Duv7XqUVIDoo=";
+  };
+
+  vendorHash = "sha256-iWNuPxetYH9xJpf3WMoA5c50kII9DUpWvhTVSE1kSk0=";
+
+  subPackages = [ "." ];
+
+  # disabled because it is required to run on docker.
+  doCheck = false;
+
+  CGO_ENABLED = 0;
+  GOFLAGS = [ "-trimpath" ];
+  ldflags = [
+    "-s"
+    "-w"
+    "-X main.version=${version}"
+    "-X main.builtBy=nixpkgs"
+  ];
+
+  nativeBuildInputs = [ installShellFiles ];
+
+  postInstall = ''
+    installShellCompletion --cmd gtrash \
+      --bash <($out/bin/gtrash completion bash) \
+      --fish <($out/bin/gtrash completion fish) \
+      --zsh <($out/bin/gtrash completion zsh)
+  '';
+
+  meta = with lib; {
+    description = "A Trash CLI manager written in Go";
+    homepage = "https://github.com/umlx5h/gtrash";
+    changelog = "https://github.com/umlx5h/gtrash/releases/tag/v${version}";
+    license = licenses.mit;
+    maintainers = with maintainers; [ umlx5h ];
+    mainProgram = "gtrash";
+  };
+}