lol
1{ lib, stdenv
2, makeWrapper
3, awscli
4, jq
5, unixtools
6, fetchFromGitHub
7, installShellFiles
8, bashInteractive
9}:
10
11stdenv.mkDerivation rec {
12 pname = "bash-my-aws";
13 version = "unstable-2020-01-11";
14
15 src = fetchFromGitHub {
16 owner = "bash-my-aws";
17 repo = "bash-my-aws";
18 rev = "5a97ce2c22affca1299022a5afa109d7b62242ba";
19 sha256 = "sha256-RZvaiyRK8FnZbHyLkWz5VrAcsnMtHCiIo64GpNZgvqY=";
20 };
21
22 dontConfigure = true;
23 dontBuild = true;
24
25 propagatedBuildInputs = [
26 awscli
27 jq
28 unixtools.column
29 bashInteractive
30 ];
31 nativeBuildInputs = [ makeWrapper installShellFiles ];
32
33 checkPhase = ''
34 pushd test
35 ./shared-spec.sh
36 ./stack-spec.sh
37 popd
38 '';
39 installPhase=''
40 mkdir -p $out
41 cp -r . $out
42 '';
43 postFixup = ''
44 pushd $out
45 substituteInPlace scripts/build \
46 --replace '~/.bash-my-aws' $out
47 substituteInPlace scripts/build-completions \
48 --replace "{HOME}" $out \
49 --replace '~/.bash-my-aws' $out
50 ./scripts/build
51 ./scripts/build-completions
52 substituteInPlace bash_completion.sh \
53 --replace "{HOME}" $out \
54 --replace .bash-my-aws ""
55 substituteInPlace bin/bma \
56 --replace '~/.bash-my-aws' $out
57 wrapProgram $out/bin/bma --prefix PATH : ${lib.makeBinPath [awscli jq unixtools.column bashInteractive ]}
58 installShellCompletion --bash --name bash-my-aws.bash bash_completion.sh
59 chmod +x $out/lib/*
60 patchShebangs --host $out/lib
61 installShellCompletion --bash --name bash-my-aws.bash bash_completion.sh
62 cat > $out/bin/bma-init <<EOF
63 echo source $out/aliases
64 echo source $out/bash_completion.sh
65 EOF
66 chmod +x $out/bin/bma-init
67 popd
68 '';
69
70 meta = with lib; {
71 homepage = "https://bash-my-aws.org";
72 description = "CLI commands for AWS";
73 license = licenses.mit;
74 maintainers = with maintainers; [ tomberek ];
75 };
76}