2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv
|
2020-08-14 02:43:19 +00:00
|
|
|
, makeWrapper
|
2020-01-01 17:10:47 +00:00
|
|
|
, awscli
|
|
|
|
, jq
|
2020-08-14 02:43:19 +00:00
|
|
|
, unixtools
|
2022-03-08 14:29:35 +00:00
|
|
|
, fetchFromGitHub
|
2020-01-01 17:10:47 +00:00
|
|
|
, installShellFiles
|
|
|
|
, bashInteractive
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bash-my-aws";
|
2022-03-08 14:29:35 +00:00
|
|
|
version = "unstable-2020-01-11";
|
2020-01-01 17:10:47 +00:00
|
|
|
|
2022-03-08 14:29:35 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "bash-my-aws";
|
|
|
|
repo = "bash-my-aws";
|
2020-01-12 00:52:03 +00:00
|
|
|
rev = "5a97ce2c22affca1299022a5afa109d7b62242ba";
|
2022-03-08 14:29:35 +00:00
|
|
|
sha256 = "sha256-RZvaiyRK8FnZbHyLkWz5VrAcsnMtHCiIo64GpNZgvqY=";
|
2020-01-01 17:10:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
awscli
|
|
|
|
jq
|
2020-08-14 02:43:19 +00:00
|
|
|
unixtools.column
|
2020-01-01 17:10:47 +00:00
|
|
|
bashInteractive
|
|
|
|
];
|
2020-08-14 02:43:19 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
2020-01-01 17:10:47 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
pushd test
|
|
|
|
./shared-spec.sh
|
|
|
|
./stack-spec.sh
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
installPhase=''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r . $out
|
|
|
|
'';
|
|
|
|
postFixup = ''
|
|
|
|
pushd $out
|
2020-01-12 00:52:03 +00:00
|
|
|
substituteInPlace scripts/build \
|
|
|
|
--replace '~/.bash-my-aws' $out
|
|
|
|
substituteInPlace scripts/build-completions \
|
|
|
|
--replace "{HOME}" $out \
|
|
|
|
--replace '~/.bash-my-aws' $out
|
|
|
|
./scripts/build
|
|
|
|
./scripts/build-completions
|
|
|
|
substituteInPlace bash_completion.sh \
|
|
|
|
--replace "{HOME}" $out \
|
|
|
|
--replace .bash-my-aws ""
|
|
|
|
substituteInPlace bin/bma \
|
|
|
|
--replace '~/.bash-my-aws' $out
|
2020-08-14 02:43:19 +00:00
|
|
|
wrapProgram $out/bin/bma --prefix PATH : ${lib.makeBinPath [awscli jq unixtools.column bashInteractive ]}
|
2020-01-12 00:52:03 +00:00
|
|
|
installShellCompletion --bash --name bash-my-aws.bash bash_completion.sh
|
|
|
|
chmod +x $out/lib/*
|
|
|
|
patchShebangs --host $out/lib
|
|
|
|
installShellCompletion --bash --name bash-my-aws.bash bash_completion.sh
|
|
|
|
cat > $out/bin/bma-init <<EOF
|
|
|
|
echo source $out/aliases
|
|
|
|
echo source $out/bash_completion.sh
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/bma-init
|
2020-01-01 17:10:47 +00:00
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://bash-my-aws.org";
|
2020-01-01 17:10:47 +00:00
|
|
|
description = "CLI commands for AWS";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ tomberek ];
|
|
|
|
};
|
|
|
|
}
|