nixpkgs/pkgs/tools/admin/oci-cli/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

111 lines
2.5 KiB
Nix
Raw Normal View History

2022-01-10 09:29:45 +00:00
{ lib
, fetchFromGitHub
2023-09-19 14:11:19 +00:00
, fetchPypi
2022-01-10 09:29:45 +00:00
, python3
2024-02-29 23:43:00 +00:00
, installShellFiles
2022-01-10 09:29:45 +00:00
}:
2021-04-14 11:33:26 +00:00
let
2022-01-10 09:29:45 +00:00
py = python3.override {
packageOverrides = self: super: {
click = super.click.overridePythonAttrs (oldAttrs: rec {
version = "7.1.2";
2021-04-14 11:33:26 +00:00
2023-09-19 14:11:19 +00:00
src = fetchPypi {
pname = "click";
2022-01-10 09:29:45 +00:00
inherit version;
hash = "sha256-0rUlXHxjSbwb0eWeCM0SrLvWPOZJ8liHVXg6qU37axo=";
};
disabledTests = [ "test_bytes_args" ]; # https://github.com/pallets/click/commit/6e05e1fa1c2804
2022-01-10 09:29:45 +00:00
});
2021-04-14 11:33:26 +00:00
jmespath = super.jmespath.overridePythonAttrs (oldAttrs: rec {
version = "0.10.0";
src = oldAttrs.src.override {
inherit version;
sha256 = "b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9";
hash = "";
};
2022-08-13 20:08:43 +00:00
doCheck = false;
});
2022-01-10 09:29:45 +00:00
};
};
2021-04-14 11:33:26 +00:00
in
2022-01-10 09:29:45 +00:00
with py.pkgs;
2021-04-14 11:33:26 +00:00
2022-01-10 09:29:45 +00:00
buildPythonApplication rec {
2021-04-14 11:33:26 +00:00
pname = "oci-cli";
2022-08-13 20:08:43 +00:00
version = "3.14.0";
2022-01-10 09:29:45 +00:00
format = "setuptools";
2021-04-14 11:33:26 +00:00
src = fetchFromGitHub {
owner = "oracle";
2022-08-13 20:08:43 +00:00
repo = pname;
2021-04-14 11:33:26 +00:00
rev = "v${version}";
2022-08-13 20:08:43 +00:00
hash = "sha256-yooEZuSIw2EMJVyT/Z/x4hJi8a1F674CtsMMGkMAYLg=";
2021-04-14 11:33:26 +00:00
};
2024-02-29 23:43:00 +00:00
nativeBuildInputs = [ installShellFiles ];
2022-01-10 09:29:45 +00:00
propagatedBuildInputs = [
arrow
certifi
click
cryptography
jmespath
oci
2022-08-13 20:08:43 +00:00
prompt-toolkit
2022-01-10 09:29:45 +00:00
pyopenssl
python-dateutil
pytz
pyyaml
retrying
six
terminaltables
2021-04-14 11:33:26 +00:00
];
postPatch = ''
substituteInPlace setup.py \
2022-08-13 20:08:43 +00:00
--replace "cryptography>=3.2.1,<=37.0.2" "cryptography" \
--replace "pyOpenSSL>=17.5.0,<=22.0.0" "pyOpenSSL" \
2022-01-10 09:29:45 +00:00
--replace "PyYAML>=5.4,<6" "PyYAML" \
2022-08-13 20:08:43 +00:00
--replace "prompt-toolkit==3.0.29" "prompt-toolkit" \
2022-09-14 14:08:08 +00:00
--replace "terminaltables==3.1.0" "terminaltables" \
--replace "oci==2.78.0" "oci"
2021-04-14 11:33:26 +00:00
'';
2024-02-29 23:43:00 +00:00
postInstall = ''
cat >oci.zsh <<EOF
#compdef oci
zmodload -i zsh/parameter
autoload -U +X bashcompinit && bashcompinit
if ! (( $+functions[compdef] )) ; then
autoload -U +X compinit && compinit
fi
EOF
cat src/oci_cli/bin/oci_autocomplete.sh >>oci.zsh
installShellCompletion \
--cmd oci \
--bash src/oci_cli/bin/oci_autocomplete.sh \
--zsh oci.zsh
'';
2022-01-10 09:29:45 +00:00
# https://github.com/oracle/oci-cli/issues/187
doCheck = false;
pythonImportsCheck = [
" oci_cli "
];
2021-04-14 11:33:26 +00:00
meta = with lib; {
description = "Command Line Interface for Oracle Cloud Infrastructure";
homepage = "https://docs.cloud.oracle.com/iaas/Content/API/Concepts/cliconcepts.htm";
2022-01-10 09:29:45 +00:00
license = with licenses; [ asl20 /* or */ upl ];
2021-04-14 11:33:26 +00:00
maintainers = with maintainers; [ ilian ];
};
}