1{
2 lib,
3 fetchFromGitHub,
4 python3,
5 installShellFiles,
6 nix-update-script,
7}:
8
9let
10 py = python3.override {
11 self = py;
12 packageOverrides = self: super: {
13 jmespath = super.jmespath.overridePythonAttrs (oldAttrs: rec {
14 version = "0.10.0";
15 src = oldAttrs.src.override {
16 inherit version;
17 sha256 = "b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9";
18 hash = "";
19 };
20 doCheck = false;
21 });
22 };
23 };
24in
25
26py.pkgs.buildPythonApplication rec {
27 pname = "oci-cli";
28 version = "3.63.0";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "oracle";
33 repo = "oci-cli";
34 tag = "v${version}";
35 hash = "sha256-29jEfzS/hJQKX6P3VL/Wy+0/3DFmOKFj4RTTGkVhXXM=";
36 };
37
38 nativeBuildInputs = [ installShellFiles ];
39
40 build-system = with py.pkgs; [
41 setuptools
42 ];
43
44 dependencies = with py.pkgs; [
45 arrow
46 certifi
47 click
48 cryptography
49 jmespath
50 oci
51 prompt-toolkit
52 pyopenssl
53 python-dateutil
54 pytz
55 pyyaml
56 retrying
57 six
58 terminaltables
59 ];
60
61 pythonRelaxDeps = [
62 "click"
63 "PyYAML"
64 "cryptography"
65 "oci"
66 "prompt-toolkit"
67 "pyOpenSSL"
68 "terminaltables"
69 ];
70
71 # Propagating dependencies leaks them through $PYTHONPATH which causes issues
72 # when used in nix-shell.
73 postFixup = ''
74 rm $out/nix-support/propagated-build-inputs
75 '';
76
77 postInstall = ''
78 cat >oci.zsh <<EOF
79 #compdef oci
80 zmodload -i zsh/parameter
81 autoload -U +X bashcompinit && bashcompinit
82 if ! (( $+functions[compdef] )) ; then
83 autoload -U +X compinit && compinit
84 fi
85
86 EOF
87 cat src/oci_cli/bin/oci_autocomplete.sh >>oci.zsh
88
89 installShellCompletion \
90 --cmd oci \
91 --bash src/oci_cli/bin/oci_autocomplete.sh \
92 --zsh oci.zsh
93 '';
94
95 doCheck = true;
96
97 pythonImportsCheck = [
98 "oci_cli"
99 ];
100
101 passthru.updateScript = nix-update-script { };
102
103 meta = with lib; {
104 description = "Command Line Interface for Oracle Cloud Infrastructure";
105 homepage = "https://docs.cloud.oracle.com/iaas/Content/API/Concepts/cliconcepts.htm";
106 license = with licenses; [
107 asl20 # or
108 upl
109 ];
110 maintainers = with maintainers; [
111 ilian
112 FKouhai
113 ];
114 };
115}