nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, python3
3, groff
4, less
5, fetchFromGitHub
6, nix-update-script
7, testers
8, awscli2
9}:
10
11let
12 py = python3 // {
13 pkgs = python3.pkgs.overrideScope (self: super: {
14 # nothing right now
15 });
16 };
17
18in
19with py.pkgs; buildPythonApplication rec {
20 pname = "awscli2";
21 version = "2.11.27"; # N.B: if you change this, check if overrides are still up-to-date
22 format = "pyproject";
23
24 src = fetchFromGitHub {
25 owner = "aws";
26 repo = "aws-cli";
27 rev = version;
28 hash = "sha256-GjnNW5VaWLz8QXIdYZJC0oho3K2Cu//cAgnwQ6lBbTQ=";
29 };
30
31 postPatch = ''
32 substituteInPlace requirements/bootstrap.txt \
33 --replace "pip>=22.0.0,<23.0.0" "pip>=22.0.0,<24.0.0"
34 '';
35
36 nativeBuildInputs = [
37 flit-core
38 ];
39
40 propagatedBuildInputs = [
41 awscrt
42 bcdoc
43 colorama
44 cryptography
45 distro
46 docutils
47 groff
48 less
49 prompt-toolkit
50 pyyaml
51 rsa
52 ruamel-yaml
53 python-dateutil
54 jmespath
55 urllib3
56 ];
57
58 nativeCheckInputs = [
59 jsonschema
60 mock
61 pytestCheckHook
62 ];
63
64 postInstall = ''
65 mkdir -p $out/${python3.sitePackages}/awscli/data
66 ${python3.interpreter} scripts/gen-ac-index --index-location $out/${python3.sitePackages}/awscli/data/ac.index
67
68 mkdir -p $out/share/bash-completion/completions
69 echo "complete -C $out/bin/aws_completer aws" > $out/share/bash-completion/completions/aws
70
71 mkdir -p $out/share/zsh/site-functions
72 mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions
73
74 rm $out/bin/aws.cmd
75 '';
76
77 doCheck = true;
78
79 preCheck = ''
80 export PATH=$PATH:$out/bin
81 export HOME=$(mktemp -d)
82 '';
83
84 pytestFlagsArray = [
85 "-Wignore::DeprecationWarning"
86 ];
87
88 disabledTestPaths = [
89 # Integration tests require networking
90 "tests/integration"
91
92 # Disable slow tests (only run unit tests)
93 "tests/backends"
94 "tests/functional"
95 ];
96
97 pythonImportsCheck = [
98 "awscli"
99 ];
100
101 passthru = {
102 python = py; # for aws_shell
103 updateScript = nix-update-script {
104 # Excludes 1.x versions from the Github tags list
105 extraArgs = [ "--version-regex" "^(2\.(.*))" ];
106 };
107 tests.version = testers.testVersion {
108 package = awscli2;
109 command = "aws --version";
110 version = version;
111 };
112 };
113
114 meta = with lib; {
115 homepage = "https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html";
116 changelog = "https://github.com/aws/aws-cli/blob/${version}/CHANGELOG.rst";
117 description = "Unified tool to manage your AWS services";
118 license = licenses.asl20;
119 maintainers = with maintainers; [ bhipple davegallant bryanasdev000 devusb anthonyroussel ];
120 mainProgram = "aws";
121 };
122}