nixpkgs/pkgs/servers/teleport/default.nix
Anders Kaseorg 4be2fcb69e teleport: 6.1.3 → 6.2.3
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-06-08 19:11:42 -07:00

80 lines
2.1 KiB
Nix

# This file was generated by https://github.com/kamilchm/go2nix v2.0-dev
{ lib, buildGoModule, zip, fetchFromGitHub, makeWrapper, xdg-utils }:
let
webassets = fetchFromGitHub {
owner = "gravitational";
repo = "webassets";
rev = "8c2812c169fa6bd5f31c13160bd93ef8b317bbc9";
sha256 = "sha256-O+H8N1yqQiH645mgXeSc330GRmxF+gxiJJ5iYn65Z6Q=";
};
in
buildGoModule rec {
pname = "teleport";
version = "6.2.3";
# This repo has a private submodule "e" which fetchgit cannot handle without failing.
src = fetchFromGitHub {
owner = "gravitational";
repo = "teleport";
rev = "v${version}";
sha256 = "sha256-3syl1a2ui8/aTgCvihuhg575Df31loOXuENBNJG3nR0=";
};
vendorSha256 = null;
subPackages = [ "tool/tctl" "tool/teleport" "tool/tsh" ];
nativeBuildInputs = [ zip makeWrapper ];
# https://github.com/NixOS/nixpkgs/issues/120738
patches = [ ./tsh.patch ];
postBuild = ''
pushd .
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
'';
# Do not strip the embedded web assets
dontStrip = true;
# Reduce closure size for client machines
outputs = [ "out" "client" ];
buildTargets = [ "full" ];
preCheck = ''
export HOME=$(mktemp -d)
'';
postInstall = ''
install -Dm755 -t $client/bin $out/bin/tsh
wrapProgram $client/bin/tsh --prefix PATH : ${lib.makeBinPath [ xdg-utils ]}
wrapProgram $out/bin/tsh --prefix PATH : ${lib.makeBinPath [ xdg-utils ]}
'';
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://goteleport.com/";
license = licenses.asl20;
maintainers = with maintainers; [ sigma tomberek freezeboy ];
platforms = platforms.unix;
};
}