nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python3Packages,
4 fetchFromGitHub,
5 groff,
6 less,
7 nix-update-script,
8 testers,
9 awscli,
10}:
11
12let
13 self = python3Packages.buildPythonApplication rec {
14 pname = "awscli";
15 # N.B: if you change this, change botocore and boto3 to a matching version too
16 # check e.g. https://github.com/aws/aws-cli/blob/1.33.21/setup.py
17 version = "1.44.21";
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "aws";
22 repo = "aws-cli";
23 tag = version;
24 hash = "sha256-yQFK1YjehmACZGMXfMQLc5OiiIGDO08OtwFSpaRyi58=";
25 };
26
27 pythonRelaxDeps = [
28 # botocore must not be relaxed
29 "docutils"
30 "rsa"
31 ];
32
33 build-system = with python3Packages; [
34 setuptools
35 ];
36
37 dependencies = with python3Packages; [
38 botocore
39 docutils
40 s3transfer
41 pyyaml
42 colorama
43 rsa
44
45 groff
46 less
47 ];
48
49 postInstall = ''
50 mkdir -p $out/share/bash-completion/completions
51 echo "complete -C $out/bin/aws_completer aws" > $out/share/bash-completion/completions/awscli
52
53 mkdir -p $out/share/zsh/site-functions
54 mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions
55
56 rm $out/bin/aws.cmd
57 '';
58
59 doInstallCheck = true;
60
61 installCheckPhase = ''
62 runHook preInstallCheck
63
64 $out/bin/aws --version | grep "${python3Packages.botocore.version}"
65 $out/bin/aws --version | grep "${version}"
66
67 runHook postInstallCheck
68 '';
69
70 passthru = {
71 python = python3Packages.python; # for aws_shell
72 updateScript = nix-update-script {
73 extraArgs = [ "--version=skip" ];
74 };
75 tests.version = testers.testVersion {
76 package = awscli;
77 command = "aws --version";
78 inherit version;
79 };
80 };
81
82 meta = {
83 homepage = "https://aws.amazon.com/cli/";
84 changelog = "https://github.com/aws/aws-cli/blob/${version}/CHANGELOG.rst";
85 description = "Unified tool to manage your AWS services";
86 license = lib.licenses.asl20;
87 mainProgram = "aws";
88 maintainers = with lib.maintainers; [ anthonyroussel ];
89 };
90 };
91in
92assert self ? pythonRelaxDeps -> !(lib.elem "botocore" self.pythonRelaxDeps);
93self