Unverified Commit a870a6e9 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

saml2aws: install shell completion (#339219)

parents 671844dc b2654f9d
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
{ lib, stdenv, buildGoModule, fetchFromGitHub, AppKit }:
{
  lib,
  stdenv,
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,
  AppKit,
}:

buildGoModule rec {
  pname = "saml2aws";
@@ -13,14 +20,24 @@ buildGoModule rec {

  vendorHash = "sha256-gtl8T8wXnpLgDZc6qSgFKpA+XbcLNHf20ieBkyNdE+s=";

  nativeBuildInputs = [ installShellFiles ];
  buildInputs = lib.optionals stdenv.isDarwin [ AppKit ];

  subPackages = [ "." "cmd/saml2aws" ];
  subPackages = [
    "."
    "cmd/saml2aws"
  ];

  ldflags = [
    "-X main.Version=${version}"
  ];

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    installShellCompletion --cmd saml2aws \
      --bash <($out/bin/saml2aws --completion-script-bash) \
      --zsh <($out/bin/saml2aws --completion-script-zsh)
  '';

  meta = with lib; {
    description = "CLI tool which enables you to login and retrieve AWS temporary credentials using a SAML IDP";
    mainProgram = "saml2aws";