1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 23:20:55 +00:00
nixpkgs/pkgs/servers/teleport/default.nix
2021-04-25 18:49:21 +03:00

78 lines
2 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 = "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;
};
}