about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/script-directory/default.nix
blob: 59ede7bdccd9d0b907c3b08cabbf3a6e51cc8fd2 (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
40
41
42
{ lib
, stdenvNoCC
, fetchFromGitHub
, installShellFiles
, patsh
}:

stdenvNoCC.mkDerivation rec {
  pname = "script-directory";
  version = "1.1.0";

  src = fetchFromGitHub {
    owner = "ianthehenry";
    repo = "sd";
    rev = "v${version}";
    hash = "sha256-X5RWCJQUqDnG2umcCk5KS6HQinTJVapBHp6szEmbc4U=";
  };

  nativeBuildInputs = [
    installShellFiles
    patsh
  ];

  installPhase = ''
    runHook preInstall

    patsh -f sd
    install -Dt "$out/bin" sd
    installShellCompletion --zsh _sd

    runHook postInstall
  '';

  meta = {
    description = "A cozy nest for your scripts";
    homepage = "https://github.com/ianthehenry/sd";
    changelog = "https://github.com/ianthehenry/sd/tree/${src.rev}#changelog";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ janik ];
    mainProgram = "sd";
  };
}