Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, python3
3, groff
4, less
5, fetchFromGitHub
6, nix-update-script
7}:
8
9let
10 py = python3.override {
11 packageOverrides = self: super: {
12 awscrt = super.awscrt.overridePythonAttrs (oldAttrs: rec {
13 version = "0.14.0";
14 src = self.fetchPypi {
15 inherit (oldAttrs) pname;
16 inherit version;
17 hash = "sha256-MGLTFcsWVC/gTdgjny6LwyOO6QRc1QcLkVzy677Lqqw=";
18 };
19 });
20
21 prompt-toolkit = super.prompt-toolkit.overridePythonAttrs (oldAttrs: rec {
22 version = "3.0.28";
23 src = self.fetchPypi {
24 pname = "prompt_toolkit";
25 inherit version;
26 hash = "sha256-nxzRax6GwpaPJRnX+zHdnWaZFvUVYSwmnRTp7VK1FlA=";
27 };
28 });
29 };
30 };
31
32in
33with py.pkgs; buildPythonApplication rec {
34 pname = "awscli2";
35 version = "2.8.12"; # N.B: if you change this, check if overrides are still up-to-date
36 format = "pyproject";
37
38 src = fetchFromGitHub {
39 owner = "aws";
40 repo = "aws-cli";
41 rev = version;
42 sha256 = "sha256-OeOSSB0WgVJEszmkXmMkmJNq37sPID7HFaTbXkBUwlI=";
43 };
44
45 nativeBuildInputs = [
46 flit-core
47 ];
48
49 propagatedBuildInputs = [
50 awscrt
51 bcdoc
52 colorama
53 cryptography
54 distro
55 docutils
56 groff
57 less
58 prompt-toolkit
59 pyyaml
60 rsa
61 ruamel-yaml
62 wcwidth
63 python-dateutil
64 jmespath
65 urllib3
66 ];
67
68 checkInputs = [
69 jsonschema
70 mock
71 pytestCheckHook
72 ];
73
74 postPatch = ''
75 substituteInPlace pyproject.toml \
76 --replace "colorama>=0.2.5,<0.4.4" "colorama" \
77 --replace "distro>=1.5.0,<1.6.0" "distro" \
78 --replace "docutils>=0.10,<0.16" "docutils" \
79 --replace "wcwidth<0.2.0" "wcwidth"
80 '';
81
82 postInstall = ''
83 mkdir -p $out/${python3.sitePackages}/awscli/data
84 ${python3.interpreter} scripts/gen-ac-index --index-location $out/${python3.sitePackages}/awscli/data/ac.index
85
86 mkdir -p $out/share/bash-completion/completions
87 echo "complete -C $out/bin/aws_completer aws" > $out/share/bash-completion/completions/aws
88
89 mkdir -p $out/share/zsh/site-functions
90 mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions
91
92 rm $out/bin/aws.cmd
93 '';
94
95 doCheck = true;
96
97 preCheck = ''
98 export PATH=$PATH:$out/bin
99 export HOME=$(mktemp -d)
100 '';
101
102 pytestFlagsArray = [
103 "-Wignore::DeprecationWarning"
104 ];
105
106 disabledTestPaths = [
107 # Integration tests require networking
108 "tests/integration"
109
110 # Disable slow tests (only run unit tests)
111 "tests/backends"
112 "tests/functional"
113 ];
114
115 pythonImportsCheck = [
116 "awscli"
117 ];
118
119 passthru = {
120 python = py; # for aws_shell
121 updateScript = nix-update-script {
122 attrPath = pname;
123 };
124 };
125
126 meta = with lib; {
127 homepage = "https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html";
128 changelog = "https://github.com/aws/aws-cli/blob/${version}/CHANGELOG.rst";
129 description = "Unified tool to manage your AWS services";
130 license = licenses.asl20;
131 maintainers = with maintainers; [ bhipple davegallant bryanasdev000 devusb anthonyroussel ];
132 };
133}