1{
2 rustPlatform,
3 fetchFromGitHub,
4 installShellFiles,
5 lib,
6}:
7rustPlatform.buildRustPackage rec {
8 pname = "srgn";
9 version = "0.14.0";
10
11 src = fetchFromGitHub {
12 owner = "alexpovel";
13 repo = "srgn";
14 rev = "srgn-v${version}";
15 hash = "sha256-ZWjpkClhac4VD4b/Veffb5FHGvh+oeTu3ukaOux6MG0=";
16 };
17
18 cargoHash = "sha256-d/wFD0kxWNOsYaY4G5P9iM85dSo0UZGSte5AqOosM2g=";
19
20 nativeBuildInputs = [ installShellFiles ];
21
22 postInstall = ''
23 for shell in bash zsh fish; do
24 installShellCompletion --cmd srgn "--$shell" <("$out/bin/srgn" --completions "$shell")
25 done
26 '';
27
28 meta = with lib; {
29 description = "Code surgeon for precise text and code transplantation";
30 license = licenses.mit;
31 maintainers = with maintainers; [ magistau ];
32 mainProgram = "srgn";
33 homepage = "https://github.com/${src.owner}/${src.repo}/";
34 downloadPage = "https://github.com/${src.owner}/${src.repo}/releases/tag/${src.rev}";
35 changelog = "https://github.com/${src.owner}/${src.repo}/blob/${src.rev}/CHANGELOG.md";
36 };
37}