My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nomicon/pkgs/servers/teleport/default.nix

78 lines
2.0 KiB

# 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 = "cf396f868aebb8ba654ea2398c25f033181e7114";
sha256 = "sha256-12jkpWl/kL0ttRHtxyDnKjYAZNrheEGQF8HEGSXvvAk=";
};
in
buildGoModule rec {
pname = "teleport";
version = "6.1.2";
# This repo has a private submodule "e" which fetchgit cannot handle without failing.
src = fetchFromGitHub {
owner = "gravitational";
repo = "teleport";
rev = "v${version}";
sha256 = "sha256-4ZaebTTgGrGRQbMfDw1PL/qtDKmHbSY6kPmWyFeIcAU=";
};
vendorSha256 = null;
subPackages = [ "tool/tctl" "tool/teleport" "tool/tsh" ];
nativeBuildInputs = [ zip makeWrapper ];
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 : ${xdg-utils}/bin
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://goteleport.com/";
license = licenses.asl20;
maintainers = with maintainers; [ sigma tomberek freezeboy ];
platforms = platforms.unix;
};
}