2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, python3
|
2023-07-15 17:15:38 +00:00
|
|
|
, fetchPypi
|
2020-04-24 23:36:52 +00:00
|
|
|
, groff
|
|
|
|
, less
|
2023-11-16 04:20:00 +00:00
|
|
|
, nix-update-script
|
|
|
|
, testers
|
|
|
|
, awscli
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
let
|
|
|
|
botocoreVersion = python3.pkgs.botocore.version;
|
|
|
|
# awscli.version should be pinned to 2 minor versions less than the botocoreVersion
|
|
|
|
versionMinor = toString (lib.toInt (lib.versions.minor botocoreVersion) - 2);
|
|
|
|
versionPatch = lib.versions.patch botocoreVersion;
|
|
|
|
self = python3.pkgs.buildPythonApplication rec {
|
|
|
|
pname = "awscli";
|
|
|
|
version = "1.${versionMinor}.${versionPatch}"; # N.B: if you change this, change botocore and boto3 to a matching version too
|
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
hash = "sha256-GPcXkl2H0XNaeqt2/qD5+KvW23dRB0X+zLWo9hLigQM=";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
python3.pkgs.pythonRelaxDepsHook
|
|
|
|
];
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
pythonRelaxDeps = [
|
|
|
|
# botocore must not be relaxed
|
|
|
|
"colorama"
|
|
|
|
"docutils"
|
|
|
|
"rsa"
|
|
|
|
];
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
build-system = [
|
|
|
|
python3.pkgs.setuptools
|
|
|
|
];
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
|
|
botocore
|
|
|
|
s3transfer
|
|
|
|
colorama
|
|
|
|
docutils
|
|
|
|
rsa
|
|
|
|
pyyaml
|
|
|
|
groff
|
|
|
|
less
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/bash-completion/completions
|
|
|
|
echo "complete -C $out/bin/aws_completer aws" > $out/share/bash-completion/completions/awscli
|
2020-11-21 19:51:51 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
mkdir -p $out/share/zsh/site-functions
|
|
|
|
mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions
|
2020-11-21 19:51:51 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
rm $out/bin/aws.cmd
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
doInstallCheck = true;
|
2023-08-10 07:59:29 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
$out/bin/aws --version | grep "${botocoreVersion}"
|
|
|
|
$out/bin/aws --version | grep "${version}"
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
passthru = {
|
|
|
|
python = python3; # for aws_shell
|
|
|
|
updateScript = nix-update-script {
|
|
|
|
extraArgs = [ "--version=skip" ];
|
|
|
|
};
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = awscli;
|
|
|
|
command = "aws --version";
|
|
|
|
inherit version;
|
|
|
|
};
|
2023-11-16 04:20:00 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://aws.amazon.com/cli/";
|
|
|
|
changelog = "https://github.com/aws/aws-cli/blob/${version}/CHANGELOG.rst";
|
|
|
|
description = "Unified tool to manage your AWS services";
|
|
|
|
license = licenses.asl20;
|
|
|
|
mainProgram = "aws";
|
|
|
|
maintainers = with maintainers; [ anthonyroussel ];
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-05-15 15:35:15 +00:00
|
|
|
in
|
|
|
|
assert self ? pythonRelaxDeps -> !(lib.elem "botocore" self.pythonRelaxDeps);
|
|
|
|
self
|