about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/zig/shell-completions.nix
blob: 74beb5f63d65a5af777befe600d66825d521874a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ lib
, stdenv
, fetchFromGitHub
, installShellFiles
}:

stdenv.mkDerivation rec {
  pname = "zig-shell-completions";
  version = "unstable-2023-08-17";

  src = fetchFromGitHub {
    owner = "ziglang";
    repo = "shell-completions";
    rev = "de9f83166d792cce6a0524e63d2755952dd9872c";
    hash = "sha256-92n41/AWbHYkXiBtbWw+hXZKJCE7KW9igd8cLSBQfHo=";
  };

  nativeBuildInputs = [ installShellFiles ];

  dontConfigure = true;
  dontBuild = true;

  installPhase = ''
    runHook preInstall

    installShellCompletion --bash --name zig.bash _zig.bash
    installShellCompletion --zsh --name _zig _zig

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://github.com/ziglang/shell-completions";
    description = "Shell completions for the Zig compiler";
    license = licenses.mit;
    maintainers = with maintainers; [ aaronjheng ];
    platforms = platforms.all;
  };
}