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