nixpkgs-suyu/pkgs/tools/admin/bash-my-aws/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

71 lines
1.7 KiB
Nix

{ lib, 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 lib; {
homepage = "https://bash-my-aws.org";
description = "CLI commands for AWS";
license = licenses.mit;
maintainers = with maintainers; [ tomberek ];
};
}