about summary refs log tree commit diff
path: root/pkgs/by-name
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2023-12-14 23:25:18 +0100
committeraszlig <aszlig@nix.build>2023-12-14 23:25:18 +0100
commit801d8be71924099f489bfbd02343287d0ed049fb (patch)
treeb9e02f00a53c4cefe24f452df253ce801e73640c /pkgs/by-name
parent2634f87e4086fb5182bc8f7c6069f962d7800946 (diff)
parentdf7672c36c8e1998c2f57b56ecc33285c79286e7 (diff)
downloadnixlib-801d8be71924099f489bfbd02343287d0ed049fb.tar
nixlib-801d8be71924099f489bfbd02343287d0ed049fb.tar.gz
nixlib-801d8be71924099f489bfbd02343287d0ed049fb.tar.bz2
nixlib-801d8be71924099f489bfbd02343287d0ed049fb.tar.lz
nixlib-801d8be71924099f489bfbd02343287d0ed049fb.tar.xz
nixlib-801d8be71924099f489bfbd02343287d0ed049fb.tar.zst
nixlib-801d8be71924099f489bfbd02343287d0ed049fb.zip
Merge pull request #273562 (add aws-gate package)
This adds aws-gate, an AWS SSM Session manager client and while I'm not
using the program myself, I reviewed the work and did some rudimentary
testing (eg. whether the session-manager-plugin works).

Additionally, it also adds the unix_ar Python package which was used for
the GNU/Linux bootstrap of the aws-gate package but has been patched out
during the review. We decided to keep the unix-ar package nonetheless
since the package seems to be rather low-maintenance and the package
author is willing to keep maintaining the package.

I'm merging this right now because the package is low-impact, meet the
packaging requirements and all builds pass (including the ones for
unix_ar).
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/aw/aws-gate/disable-bootstrap.patch51
-rw-r--r--pkgs/by-name/aw/aws-gate/package.nix55
2 files changed, 106 insertions, 0 deletions
diff --git a/pkgs/by-name/aw/aws-gate/disable-bootstrap.patch b/pkgs/by-name/aw/aws-gate/disable-bootstrap.patch
new file mode 100644
index 000000000000..63b6ebce3b8a
--- /dev/null
+++ b/pkgs/by-name/aw/aws-gate/disable-bootstrap.patch
@@ -0,0 +1,51 @@
+diff --git a/aws_gate/cli.py b/aws_gate/cli.py
+index ac37c2f..9743415 100644
+--- a/aws_gate/cli.py
++++ b/aws_gate/cli.py
+@@ -7,7 +7,6 @@ from marshmallow import ValidationError
+ from yaml.scanner import ScannerError
+
+ from aws_gate import __version__, __description__
+-from aws_gate.bootstrap import bootstrap
+ from aws_gate.config import load_config_from_files
+ from aws_gate.constants import (
+     SUPPORTED_KEY_TYPES,
+@@ -59,10 +58,14 @@ def get_argument_parser(*args, **kwargs):
+
+     # 'bootstrap' subcommand
+     bootstrap_parser = subparsers.add_parser(
+-        "bootstrap", help="Download and install session-manager-plugin"
++        "bootstrap",
++        help="Download and install session-manager-plugin (disabled by nix)",
+     )
+     bootstrap_parser.add_argument(
+-        "-f", "--force", action="store_true", help="Forces bootstrap operation"
++        "-f",
++        "--force",
++        action="store_true",
++        help="Forces bootstrap operation (disabled by nix)",
+     )
+
+     # 'exec' subcommand
+@@ -268,7 +271,9 @@ def main(args=None, argument_parser=None):
+     logger.debug('Using AWS profile "%s" in region "%s"', profile, region)
+
+     if args.subcommand == "bootstrap":
+-        bootstrap(force=args.force)
++        print(
++            f"The SSM Plugin will not be downloaded as aws-gate was installed from nixpkgs and the plugin comes pre-bundled. The '--force' flag will not override this behavior."
++        )
+     elif args.subcommand == "exec":
+         exec(
+             config=config,
+diff --git a/requirements/requirements.txt b/requirements/requirements.txt
+index 50b203e..8c3496f 100644
+--- a/requirements/requirements.txt
++++ b/requirements/requirements.txt
+@@ -3,5 +3,4 @@ cryptography==39.0.2
+ marshmallow==3.19.0
+ packaging==23.0
+ PyYAML>=5.1,<6.1
+-requests==2.28.2
+ unix-ar==0.2.1
+ wrapt==1.15.0
\ No newline at end of file
diff --git a/pkgs/by-name/aw/aws-gate/package.nix b/pkgs/by-name/aw/aws-gate/package.nix
new file mode 100644
index 000000000000..b1606d3db080
--- /dev/null
+++ b/pkgs/by-name/aw/aws-gate/package.nix
@@ -0,0 +1,55 @@
+{ lib
+, fetchFromGitHub
+, installShellFiles
+, python3Packages
+, ssm-session-manager-plugin
+}:
+
+python3Packages.buildPythonApplication rec {
+  pname = "aws-gate";
+  version = "0.11.3";
+  pyproject = true;
+
+  src = fetchFromGitHub {
+    owner = "xen0l";
+    repo = pname;
+    rev = version;
+    hash = "sha256-9w2jP4s1HXf1gYiXX05Dt2iXt0bR0U48yc8h9T5M+EQ=";
+  };
+
+  patches = [
+    ./disable-bootstrap.patch
+  ];
+
+  postPatch = ''
+    rm aws_gate/bootstrap.py tests/unit/test_bootstrap.py
+  '';
+
+  nativeBuildInputs = [
+    python3Packages.setuptools
+    python3Packages.wheel
+    installShellFiles
+  ];
+
+  propagatedBuildInputs = [ ssm-session-manager-plugin ] ++ builtins.attrValues {
+    inherit (python3Packages) marshmallow boto3 pyyaml wrapt cryptography;
+  };
+
+  postInstall = ''
+    installShellCompletion --bash completions/bash/aws-gate
+    installShellCompletion --zsh completions/zsh/_aws-gate
+  '';
+
+  checkPhase = ''
+    $out/bin/${pname} --version
+  '';
+
+  meta = with lib; {
+    description = "Better AWS SSM Session manager CLI client";
+    homepage = "https://github.com/xen0l/aws-gate";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ tirimia ];
+    platforms = with platforms; linux ++ darwin;
+    mainProgram = pname;
+  };
+}