1{
2 lib,
3 python,
4 installShellFiles,
5 buildPythonApplication,
6 fetchFromGitHub,
7 boto3,
8 colorama,
9 psutil,
10 pluggy,
11 pyyaml,
12 setuptools,
13}:
14
15buildPythonApplication rec {
16 pname = "awsume";
17 version = "4.5.5";
18 format = "setuptools";
19
20 src = fetchFromGitHub {
21 owner = "trek10inc";
22 repo = "awsume";
23 rev = version;
24 sha256 = "sha256-lm9YANYckyHDoNbB1wytBm55iyBmUuxFPmZupfpReqc=";
25 };
26
27 AWSUME_SKIP_ALIAS_SETUP = 1;
28
29 nativeBuildInputs = [ installShellFiles ];
30
31 propagatedBuildInputs = [
32 colorama
33 boto3
34 psutil
35 pluggy
36 pyyaml
37 setuptools
38 ];
39
40 postPatch = ''
41 patchShebangs shell_scripts
42 substituteInPlace shell_scripts/{awsume,awsume.fish} --replace-fail "awsumepy" "$out/bin/awsumepy"
43 substituteInPlace awsume/configure/autocomplete.py --replace-fail "awsume-autocomplete" "$out/bin/awsume-autocomplete"
44 '';
45
46 postInstall = ''
47 installShellCompletion --cmd awsume \
48 --bash <(PYTHONPATH=./awsume/configure ${python}/bin/python3 -c"import autocomplete; print(autocomplete.SCRIPTS['bash'])") \
49 --zsh <(PYTHONPATH=./awsume/configure ${python}/bin/python3 -c"import autocomplete; print(autocomplete.ZSH_AUTOCOMPLETE_FUNCTION)") \
50 --fish <(PYTHONPATH=./awsume/configure ${python}/bin/python3 -c"import autocomplete; print(autocomplete.SCRIPTS['fish'])") \
51
52 rm -f $out/bin/awsume.bat
53 '';
54
55 doCheck = false;
56
57 meta = with lib; {
58 description = "Utility for easily assuming AWS IAM roles from the command line";
59 homepage = "https://github.com/trek10inc/awsume";
60 license = [ licenses.mit ];
61 mainProgram = "awsume";
62 maintainers = [ maintainers.nilp0inter ];
63 };
64}