From e5208af780025f9e5912d080d9fa814677bc62f6 Mon Sep 17 00:00:00 2001 From: Tom Bereknyei Date: Wed, 1 Jan 2020 12:10:47 -0500 Subject: [PATCH 1/2] bash-my-aws: init at 20191231 Create bma-init --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/bash-my-aws.nix | 25 ++++++++ pkgs/tools/admin/bash-my-aws/default.nix | 72 ++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 4 files changed, 100 insertions(+) create mode 100644 nixos/modules/programs/bash-my-aws.nix create mode 100644 pkgs/tools/admin/bash-my-aws/default.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 914f9a878b0..691d10aee16 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -96,6 +96,7 @@ ./programs/atop.nix ./programs/autojump.nix ./programs/bash/bash.nix + ./programs/bash-my-aws.nix ./programs/bcc.nix ./programs/browserpass.nix ./programs/captive-browser.nix diff --git a/nixos/modules/programs/bash-my-aws.nix b/nixos/modules/programs/bash-my-aws.nix new file mode 100644 index 00000000000..15e429a7549 --- /dev/null +++ b/nixos/modules/programs/bash-my-aws.nix @@ -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; + }; + } diff --git a/pkgs/tools/admin/bash-my-aws/default.nix b/pkgs/tools/admin/bash-my-aws/default.nix new file mode 100644 index 00000000000..315f8dfb37f --- /dev/null +++ b/pkgs/tools/admin/bash-my-aws/default.nix @@ -0,0 +1,72 @@ +{ stdenv +, awscli +, jq +, fetchgit +, installShellFiles +, bashInteractive +}: + +stdenv.mkDerivation rec { + pname = "bash-my-aws"; + version = "20191231"; + + src = fetchgit { + url = "https://github.com/bash-my-aws/bash-my-aws"; + rev = "ef93bd1bf8692dc2fe9f475e7c8a309eb25ef7a6"; + sha256 = "c57e8327a3dfa24f0c40b8c94eab55fa232f87044e7d59f7bc4b40e5012e83ed"; + }; + + dontConfigure = true; + dontBuild = true; + + # Why does it propagate packages that are used for testing? + propagatedBuildInputs = [ + awscli + jq + bashInteractive + ]; + nativeBuildInputs = [ installShellFiles ]; + + #Checks are failing due to missing TTY, which won't exist. + 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 + # cat > $out/bin/bma-init < Date: Sat, 11 Jan 2020 19:52:03 -0500 Subject: [PATCH 2/2] Update --- pkgs/tools/admin/bash-my-aws/default.nix | 49 ++++++++++++------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/pkgs/tools/admin/bash-my-aws/default.nix b/pkgs/tools/admin/bash-my-aws/default.nix index 315f8dfb37f..8c0dd306743 100644 --- a/pkgs/tools/admin/bash-my-aws/default.nix +++ b/pkgs/tools/admin/bash-my-aws/default.nix @@ -8,18 +8,17 @@ stdenv.mkDerivation rec { pname = "bash-my-aws"; - version = "20191231"; + version = "20200111"; src = fetchgit { url = "https://github.com/bash-my-aws/bash-my-aws"; - rev = "ef93bd1bf8692dc2fe9f475e7c8a309eb25ef7a6"; - sha256 = "c57e8327a3dfa24f0c40b8c94eab55fa232f87044e7d59f7bc4b40e5012e83ed"; + rev = "5a97ce2c22affca1299022a5afa109d7b62242ba"; + sha256 = "459bda8b244af059d96c7c8b916cf956b01cb2732d1c2888a3ae06a4d660bea6"; }; dontConfigure = true; dontBuild = true; - # Why does it propagate packages that are used for testing? propagatedBuildInputs = [ awscli jq @@ -27,7 +26,6 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ installShellFiles ]; - #Checks are failing due to missing TTY, which won't exist. checkPhase = '' pushd test ./shared-spec.sh @@ -40,26 +38,27 @@ stdenv.mkDerivation rec { ''; 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 - # cat > $out/bin/bma-init < $out/bin/bma-init <