bash-my-aws: init at 20200111 (#76793)

* bash-my-aws: init at 20191231

Create bma-init

* Update
This commit is contained in:
Danylo Hlynskyi 2020-02-05 22:37:52 +02:00 committed by GitHub
commit 437e1f69be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 0 deletions

View File

@ -98,6 +98,7 @@
./programs/autojump.nix
./programs/bandwhich.nix
./programs/bash/bash.nix
./programs/bash-my-aws.nix
./programs/bcc.nix
./programs/browserpass.nix
./programs/captive-browser.nix

View File

@ -0,0 +1,25 @@
{ config, pkgs, lib, ... }:
with lib;
let
prg = config.programs;
cfg = prg.bash-my-aws;
initScript = ''
eval $(${pkgs.bash-my-aws}/bin/bma-init)
'';
in
{
options = {
programs.bash-my-aws = {
enable = mkEnableOption "bash-my-aws";
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ bash-my-aws ];
programs.bash.interactiveShellInit = initScript;
};
}

View File

@ -0,0 +1,71 @@
{ stdenv
, awscli
, jq
, fetchgit
, installShellFiles
, bashInteractive
}:
stdenv.mkDerivation rec {
pname = "bash-my-aws";
version = "20200111";
src = fetchgit {
url = "https://github.com/bash-my-aws/bash-my-aws";
rev = "5a97ce2c22affca1299022a5afa109d7b62242ba";
sha256 = "459bda8b244af059d96c7c8b916cf956b01cb2732d1c2888a3ae06a4d660bea6";
};
dontConfigure = true;
dontBuild = true;
propagatedBuildInputs = [
awscli
jq
bashInteractive
];
nativeBuildInputs = [ installShellFiles ];
checkPhase = ''
pushd test
./shared-spec.sh
./stack-spec.sh
popd
'';
installPhase=''
mkdir -p $out
cp -r . $out
'';
postFixup = ''
pushd $out
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
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
popd
'';
meta = with stdenv.lib; {
homepage = https://bash-my-aws.org;
description = "CLI commands for AWS";
license = licenses.mit;
maintainers = with maintainers; [ tomberek ];
};
}

View File

@ -782,6 +782,8 @@ in
automirror = callPackage ../tools/misc/automirror { };
bash-my-aws = callPackage ../tools/admin/bash-my-aws { };
bcachefs-tools = callPackage ../tools/filesystems/bcachefs-tools { };
bitwarden = callPackage ../tools/security/bitwarden { };