about summary refs log tree commit diff
path: root/pkgs/tools/text/sift
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/text/sift')
-rw-r--r--pkgs/tools/text/sift/default.nix31
-rw-r--r--pkgs/tools/text/sift/deps.nix29
2 files changed, 19 insertions, 41 deletions
diff --git a/pkgs/tools/text/sift/default.nix b/pkgs/tools/text/sift/default.nix
index f282c28f8fe18..1e79570622c0b 100644
--- a/pkgs/tools/text/sift/default.nix
+++ b/pkgs/tools/text/sift/default.nix
@@ -1,27 +1,34 @@
-{ lib, buildGoPackage, fetchFromGitHub, installShellFiles }:
+{ lib, buildGoModule, fetchFromGitHub, fetchpatch, installShellFiles }:
 
-buildGoPackage rec {
+buildGoModule rec {
   pname = "sift";
   version = "0.9.0";
-  rev = "v${version}";
-
-  goPackagePath = "github.com/svent/sift";
-
-  nativeBuildInputs = [ installShellFiles ];
 
   src = fetchFromGitHub {
-    inherit rev;
     owner = "svent";
     repo = "sift";
-    sha256 = "0bgy0jf84z1c3msvb60ffj4axayfchdkf0xjnsbx9kad1v10g7i1";
+    rev = "v${version}";
+    hash = "sha256-IZ4Hwg5NzdSXtrIDNxtkzquuiHQOmLV1HSx8gpwE/i0=";
   };
 
+  vendorHash = "sha256-y883la4R4jhsS99/ohgBC9SHggybAq9hreda6quG3IY=";
+
+  patches = [
+    # Add Go Modules support
+    (fetchpatch {
+      url = "https://github.com/svent/sift/commit/b56fb3d0fd914c8a6c08b148e15dd8a07c7d8a5a.patch";
+      hash = "sha256-mFCEpkgQ8XDPRQ3yKDZ5qY9tKGSuHs+RnhMeAlx33Ng=";
+    })
+  ];
+
+  nativeBuildInputs = [ installShellFiles ];
+
+  ldflags = [ "-s" "-w" ];
+
   postInstall = ''
-    installShellCompletion --cmd sift --bash go/src/github.com/svent/sift/sift-completion.bash
+    installShellCompletion --cmd sift --bash sift-completion.bash
   '';
 
-  goDeps = ./deps.nix;
-
   meta = with lib; {
     description = "A fast and powerful alternative to grep";
     homepage = "https://sift-tool.org";
diff --git a/pkgs/tools/text/sift/deps.nix b/pkgs/tools/text/sift/deps.nix
deleted file mode 100644
index 038555fa3cab2..0000000000000
--- a/pkgs/tools/text/sift/deps.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-[
-  {
-    goPackagePath = "golang.org/x/crypto";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/crypto";
-      rev = "575fdbe86e5dd89229707ebec0575ce7d088a4a6";
-      sha256 = "1kgv1mkw9y404pk3lcwbs0vgl133mwyp294i18jg9hp10s5d56xa";
-    };
-  }
-  {
-    goPackagePath = "github.com/svent/go-flags";
-    fetch = {
-      type = "git";
-      url = "https://github.com/svent/go-flags";
-      rev = "4bcbad344f0318adaf7aabc16929701459009aa3";
-      sha256 = "1gb416fgxl9gq4q6wsv3i2grq1mzbi7lvfvmfdqbxqbv9vizzh34";
-    };
-  }
-  {
-    goPackagePath = "github.com/svent/go-nbreader";
-    fetch = {
-      type = "git";
-      url = "https://github.com/svent/go-nbreader";
-      rev = "7cef48da76dca6a496faa7fe63e39ed665cbd219";
-      sha256 = "0hw11jj5r3f6qwydg41nc3c6aadlbkhc1qpxra2609lis0qa9h4r";
-    };
-  }
-]