From 51c953ff762638c25602180adf81f729cb12434a Mon Sep 17 00:00:00 2001 From: Aaron Jheng Date: Tue, 24 Jan 2023 01:04:06 +0000 Subject: [PATCH] sift: use buildGoModule --- pkgs/tools/text/sift/default.nix | 33 +++++++++++++++++++------------- pkgs/tools/text/sift/deps.nix | 29 ---------------------------- 2 files changed, 20 insertions(+), 42 deletions(-) delete mode 100644 pkgs/tools/text/sift/deps.nix diff --git a/pkgs/tools/text/sift/default.nix b/pkgs/tools/text/sift/default.nix index f282c28f8fe1..1e79570622c0 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"; + src = fetchFromGitHub { + owner = "svent"; + repo = "sift"; + 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 ]; - src = fetchFromGitHub { - inherit rev; - owner = "svent"; - repo = "sift"; - sha256 = "0bgy0jf84z1c3msvb60ffj4axayfchdkf0xjnsbx9kad1v10g7i1"; - }; + 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 038555fa3cab..000000000000 --- 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"; - }; - } -]