Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, python3
3, fetchFromGitHub
4, fetchPypi
5, groff
6, less
7}:
8let
9 py = python3.override {
10 packageOverrides = self: super: {
11 pyyaml = super.pyyaml.overridePythonAttrs (oldAttrs: rec {
12 version = "5.4.1";
13 src = fetchFromGitHub {
14 owner = "yaml";
15 repo = "pyyaml";
16 rev = version;
17 hash = "sha256-VUqnlOF/8zSOqh6JoEYOsfQ0P4g+eYqxyFTywgCS7gM=";
18 };
19 checkPhase = ''
20 runHook preCheck
21 PYTHONPATH="tests/lib3:$PYTHONPATH" ${self.python.interpreter} -m test_all
22 runHook postCheck
23 '';
24 });
25 };
26 self = py;
27 };
28
29in
30with py.pkgs; buildPythonApplication rec {
31 pname = "awscli";
32 version = "1.27.79"; # N.B: if you change this, change botocore and boto3 to a matching version too
33
34 src = fetchPypi {
35 inherit pname version;
36 hash = "sha256-A3MVM5MV+PTwR4W2ALrqEtMaFtVAEt8yqkd4ZLsvHGE=";
37 };
38
39 # https://github.com/aws/aws-cli/issues/4837
40 postPatch = ''
41 substituteInPlace setup.py \
42 --replace "docutils>=0.10,<0.17" "docutils>=0.10" \
43 --replace "colorama>=0.2.5,<0.4.5" "colorama>=0.2.5,<0.5" \
44 --replace "rsa>=3.1.2,<4.8" "rsa<5,>=3.1.2"
45 '';
46
47 propagatedBuildInputs = [
48 botocore
49 bcdoc
50 s3transfer
51 six
52 colorama
53 docutils
54 rsa
55 pyyaml
56 groff
57 less
58 ];
59
60 postInstall = ''
61 mkdir -p $out/share/bash-completion/completions
62 echo "complete -C $out/bin/aws_completer aws" > $out/share/bash-completion/completions/awscli
63
64 mkdir -p $out/share/zsh/site-functions
65 mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions
66
67 rm $out/bin/aws.cmd
68 '';
69
70 passthru = {
71 python = py; # for aws_shell
72 };
73
74 doInstallCheck = true;
75 installCheckPhase = ''
76 runHook preInstallCheck
77
78 $out/bin/aws --version | grep "${py.pkgs.botocore.version}"
79 $out/bin/aws --version | grep "${version}"
80
81 runHook postInstallCheck
82 '';
83
84 meta = with lib; {
85 homepage = "https://aws.amazon.com/cli/";
86 changelog = "https://github.com/aws/aws-cli/blob/${version}/CHANGELOG.rst";
87 description = "Unified tool to manage your AWS services";
88 license = licenses.asl20;
89 mainProgram = "aws";
90 maintainers = with maintainers; [ ];
91 };
92}