summary refs log tree commit diff
path: root/pkgs/applications/misc/bashSnippets/default.nix
blob: 0976e7625bcf67dc6785595b214e7724610681f2 (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
43
44
45
46
47
48
49
{ stdenv, lib, fetchFromGitHub, makeWrapper
, curl, python, bind, iproute, bc, gitMinimal }:
let
  version = "1.23.0";
  deps = lib.makeBinPath [
    curl
    python
    bind.dnsutils
    iproute
    bc
    gitMinimal
  ];
in
stdenv.mkDerivation {
  pname = "bashSnippets";
  inherit version;

  src = fetchFromGitHub {
    owner = "alexanderepstein";
    repo = "Bash-Snippets";
    rev = "v${version}";
    sha256 = "044nxgd3ic2qr6hgq5nymn3dyf5i4s8mv5z4az6jvwlrjnvbg8cp";
  };

  buildInputs = [ makeWrapper ];

  patchPhase = ''
    patchShebangs install.sh
    substituteInPlace install.sh --replace /usr/local "$out"
  '';

  dontBuild = true;

  installPhase = ''
    mkdir -p "$out"/bin "$out"/share/man/man1
    ./install.sh all
    for file in "$out"/bin/*; do
      wrapProgram "$file" --prefix PATH : "${deps}"
    done
  '';

  meta = with lib; {
    description = "A collection of small bash scripts for heavy terminal users";
    homepage = https://github.com/alexanderepstein/Bash-Snippets;
    license = licenses.mit;
    maintainers = with maintainers; [ infinisil ];
    platforms = platforms.unix;
  };
}