3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/servers/teleport/default.nix
2021-04-08 12:20:46 +02:00

71 lines
2 KiB
Nix

# This file was generated by https://github.com/kamilchm/go2nix v2.0-dev
{ lib, buildGoPackage, zip, fetchFromGitHub, makeWrapper, xdg-utils }:
let
webassets = fetchFromGitHub {
owner = "gravitational";
repo = "webassets";
rev = "8ace0cfcc6867651bed3fd5b5f35aaa2a80e1106";
sha256 = "sha256-mzvYysCFMvWHo8Y4cmhAju62jjpe92j564gc12BSdZA=";
};
in
buildGoPackage rec {
pname = "teleport";
version = "5.2.1";
# This repo has a private submodule "e" which fetchgit cannot handle without failing.
src = fetchFromGitHub {
owner = "gravitational";
repo = "teleport";
rev = "v${version}";
sha256 = "sha256-8WEVH+04y1/s9KpBlK/LrgHG7qTpu2LqtanKKdi9N08=";
};
goPackagePath = "github.com/gravitational/teleport";
subPackages = [ "tool/tctl" "tool/teleport" "tool/tsh" ];
nativeBuildInputs = [ zip makeWrapper ];
postBuild = ''
pushd .
cd $NIX_BUILD_TOP/go/src/github.com/gravitational/teleport
mkdir -p build
echo "making webassets"
cp -r ${webassets}/* webassets/
make build/webassets.zip
cat build/webassets.zip >> $NIX_BUILD_TOP/go/bin/teleport
rm -fr build/webassets.zip
cd $NIX_BUILD_TOP/go/bin
zip -q -A teleport
popd
'';
# Reduce closure size for client machines
outputs = [ "out" "client" ];
buildTargets = [ "full" ];
postInstall = ''
install -Dm755 -t $client/bin $out/bin/tsh
wrapProgram $out/bin/tsh --prefix PATH : ${xdg-utils}/bin
'';
doInstallCheck = true;
installCheckPhase = ''
$out/bin/tsh version | grep ${version} > /dev/null
$client/bin/tsh version | grep ${version} > /dev/null
$out/bin/tctl version | grep ${version} > /dev/null
$out/bin/teleport version | grep ${version} > /dev/null
'';
meta = with lib; {
description = "A SSH CA management suite";
homepage = "https://gravitational.com/teleport/";
license = licenses.asl20;
maintainers = with maintainers; [ sigma tomberek freezeboy ];
platforms = platforms.unix;
};
}