bash-my-aws / bash-my-aws

Bash-my-AWS provides simple but powerful CLI commands for managing AWS resources

Home Page:https://bash-my-aws.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configurable `~/.bash-my-aws` location

tomberek opened this issue · comments

Much of the project has the location of the binaries hard coded to ~/.bash-my-aws. It would be convenient to have something similar to the --prefix in configure/make.

Using the project_root in scripts/build, or a project_prefix would be quite convenient.

It would be good to make it easier to override the default install location.

@mbailey
@tomberek found all the hardcodes and patched them out for Nixpkgs. Here's relevant patch code from https://github.com/NixOS/nixpkgs/pull/76793/files#diff-605e5b017b7a8d0435bd885ef8ce249aR41-R55:

    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

substituteInPlace is like sed -i s///g

Thanks for sharing @danbst . I've not tried nixpkgs.

Are there some simple commands I can run in a docker instance to install BMA via nixpkgs (to check it out)?

Something like this can get you something to checkout BMA in docker.

TODO: note i should add some utils and awscli as runtime-dependencies in Nix.

docker run --rm -it nixos/nix
nix-channel --update
nix-env -f '<nixpkgs>' -iA bash-my-aws utillinux awscli
bma instances

Of course you'll have to inject some AWS creds in some way to make it work correctly.