1{ lib, stdenv, fetchFromGitHub, rustPlatform, installShellFiles, Security
2}:
3
4rustPlatform.buildRustPackage rec {
5 pname = "sd";
6 version = "0.7.6";
7
8 src = fetchFromGitHub {
9 owner = "chmln";
10 repo = pname;
11 rev = "v${version}";
12 sha256 = "0c5bsqs6c55x4j640vhzlmbiylhp5agr7lx0jrwcjazfyvxihc01";
13 };
14
15 cargoSha256 = "1iwgy9zzdxay6hb9pz47jchy03jrsy5csxijlq4i228qhqnvq1lr";
16
17 nativeBuildInputs = [ installShellFiles ];
18
19 buildInputs = lib.optionals stdenv.isDarwin [ Security ];
20
21 preFixup = ''
22 installManPage $releaseDir/build/sd-*/out/sd.1
23
24 installShellCompletion $releaseDir/build/sd-*/out/sd.{bash,fish}
25 installShellCompletion --zsh $releaseDir/build/sd-*/out/_sd
26 '';
27
28 meta = with lib; {
29 description = "Intuitive find & replace CLI (sed alternative)";
30 homepage = "https://github.com/chmln/sd";
31 license = licenses.mit;
32 maintainers = with maintainers; [ amar1729 Br1ght0ne ];
33 };
34}