1{
2 lib,
3 fetchFromGitHub,
4 rustPlatform,
5 installShellFiles,
6 makeWrapper,
7 fzf,
8 stdenv,
9 nix-update-script,
10}:
11
12rustPlatform.buildRustPackage rec {
13 pname = "git-smash";
14 version = "0.1.1";
15
16 src = fetchFromGitHub {
17 owner = "anthraxx";
18 repo = "git-smash";
19 tag = "v${version}";
20 hash = "sha256-NyNYEF5g0O9xNhq+CoDPhQXZ+ISiY4DsShpjk5nP0N8=";
21 };
22
23 cargoHash = "sha256-YuSaSYr5W4zN7WnWjq7UClQtqx8AnaswOqlOq2WsZ6o=";
24
25 nativeBuildInputs = [
26 installShellFiles
27 makeWrapper
28 ];
29
30 postFixup = ''
31 wrapProgram "$out/bin/git-smash" --suffix PATH : "${lib.makeBinPath [ fzf ]}"
32 '';
33
34 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
35 installShellCompletion --cmd git-smash \
36 --bash <($out/bin/git-smash completions bash) \
37 --fish <($out/bin/git-smash completions fish) \
38 --zsh <($out/bin/git-smash completions zsh)
39 '';
40
41 passthru.updateScript = nix-update-script { };
42
43 meta = {
44 description = "Smash staged changes into previous commits to support your Git workflow, pull request and feature branch maintenance";
45 homepage = "https://github.com/anthraxx/git-smash";
46 changelog = "https://github.com/anthraxx/git-smash/blob/${src.rev}/CHANGELOG.md";
47 license = lib.licenses.mit;
48 mainProgram = "git-smash";
49 maintainers = with lib.maintainers; [ bcyran ];
50 };
51}