From 490a760b66f10ae73f8822aefcd8df64d58e95f4 Mon Sep 17 00:00:00 2001 From: Konstantin Alekseev Date: Thu, 29 Oct 2020 23:53:41 +0300 Subject: [PATCH] ssm-session-manager-plugin: 1.1.61.0 -> 1.2.7.0, add macos support --- .../ssm-session-manager-plugin/default.nix | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/networking/cluster/ssm-session-manager-plugin/default.nix b/pkgs/applications/networking/cluster/ssm-session-manager-plugin/default.nix index 7c948fbcdfc7..15a3b0ac24c7 100644 --- a/pkgs/applications/networking/cluster/ssm-session-manager-plugin/default.nix +++ b/pkgs/applications/networking/cluster/ssm-session-manager-plugin/default.nix @@ -1,28 +1,38 @@ -{ stdenv, lib, fetchurl, autoPatchelfHook, dpkg, awscli }: +{ stdenv, lib, fetchurl, autoPatchelfHook, dpkg, awscli, unzip }: +let + ver = "1.2.7.0"; + source = if stdenv.isDarwin then { + url = + "https://s3.amazonaws.com/session-manager-downloads/plugin/${ver}/mac/sessionmanager-bundle.zip"; + sha256 = "sha256-HP+opNjS53zR9eUxpNUHGD9rZN1z7lDc6+nONR8fa/s="; + } else { + url = + "https://s3.amazonaws.com/session-manager-downloads/plugin/${ver}/ubuntu_64bit/session-manager-plugin.deb"; + sha256 = "sha256-EZ9ncj1YYlod1RLfXOpZFijnKjLYWYVBb+C6yd42l34="; + }; + platformBuildInput = if stdenv.isDarwin then [ unzip ] else [ dpkg ]; + unpackCmd = if stdenv.isDarwin then "unzip $src" else "dpkg-deb -x $src ."; + archivePath = if stdenv.isDarwin then "sessionmanager-bundle" else "usr/local/sessionmanagerplugin"; +in stdenv.mkDerivation rec { pname = "ssm-session-manager-plugin"; - version = "1.1.61.0"; + version = ver; - src = fetchurl { - url = - "https://s3.amazonaws.com/session-manager-downloads/plugin/${version}/ubuntu_64bit/session-manager-plugin.deb"; - sha256 = "0z59irrpwhjjhn379454xyraqs590hij2n6n6k25w5hh8ak7imfl"; - }; + src = fetchurl source; - nativeBuildInputs = [ autoPatchelfHook dpkg ]; + nativeBuildInputs = [ autoPatchelfHook ] ++ platformBuildInput; buildInputs = [ awscli ]; - unpackPhase = "dpkg-deb -x $src ."; + unpackPhase = unpackCmd; - installPhase = - "install -m755 -D usr/local/sessionmanagerplugin/bin/session-manager-plugin $out/bin/session-manager-plugin"; + installPhase = "install -m755 -D ${archivePath}/bin/session-manager-plugin $out/bin/session-manager-plugin"; meta = with lib; { homepage = "https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html"; description = "Amazon SSM Session Manager Plugin"; - platforms = [ "x86_64-linux" ]; + platforms = [ "x86_64-linux" "x86_64-darwin" ]; license = licenses.unfree; maintainers = with maintainers; [ mbaillie ]; };