about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/misc/argbash/default.nix
blob: bf33e788633e8b33a226e004985490f9cf73c53f (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
50
{ lib
, stdenv
, fetchFromGitHub
, autoconf
, makeWrapper
, python3Packages
, runtimeShell
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "argbash";
  version = "2.10.0";

  src = fetchFromGitHub {
    owner = "matejak";
    repo = "argbash";
    rev = finalAttrs.version;
    hash = "sha256-G739q6OhsXEldpIxiyOU51AmG4RChMqaN1t2wOy6sPU=";
  };

  postPatch = ''
    patchShebangs .
    substituteInPlace resources/Makefile \
      --replace '/bin/bash' "${runtimeShell}"
  '';

  nativeBuildInputs = [
    autoconf
    makeWrapper
    python3Packages.docutils
  ];

  makeFlags = [
    "-C" "resources"
    "PREFIX=$(out)"
  ];

  postInstall = ''
    wrapProgram $out/bin/argbash \
      --prefix PATH : '${autoconf}/bin'
  '';

  meta = {
    homepage = "https://argbash.io/";
    description = "Bash argument parsing code generator";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ AndersonTorres ];
    platforms = lib.platforms.all;
  };
})