diff options
Diffstat (limited to 'pkgs/servers/teleport')
-rw-r--r-- | pkgs/servers/teleport/default.nix | 60 | ||||
-rw-r--r-- | pkgs/servers/teleport/tsh.patch | 17 |
2 files changed, 65 insertions, 12 deletions
diff --git a/pkgs/servers/teleport/default.nix b/pkgs/servers/teleport/default.nix index b307f7861fa..ad96798133b 100644 --- a/pkgs/servers/teleport/default.nix +++ b/pkgs/servers/teleport/default.nix @@ -1,29 +1,40 @@ # This file was generated by https://github.com/kamilchm/go2nix v2.0-dev -{ stdenv, buildGoPackage, zip, fetchFromGitHub }: +{ lib, buildGoModule, zip, fetchFromGitHub, makeWrapper, xdg-utils }: +let + webassets = fetchFromGitHub { + owner = "gravitational"; + repo = "webassets"; + rev = "8a30ee4e3570c7db0566028b6b562167aa40f646"; + sha256 = "sha256-noMVcB1cjiMcRke6/qJIzDaEh4uPIewsedLQRdPbzIQ="; + }; +in -buildGoPackage rec { +buildGoModule rec { pname = "teleport"; - version = "4.2.11"; + version = "6.2.7"; # This repo has a private submodule "e" which fetchgit cannot handle without failing. src = fetchFromGitHub { owner = "gravitational"; repo = "teleport"; rev = "v${version}"; - sha256 = "00mkh6rmdgwwhbk3jmxgwl0aisnnqw6q6i5zl1hn69hvdny9liii"; + sha256 = "0ychs2pqi3awbr0vraz0ksddwk5hihrd1d9raq8mxyw5dz5124ki"; }; - goPackagePath = "github.com/gravitational/teleport"; + vendorSha256 = null; subPackages = [ "tool/tctl" "tool/teleport" "tool/tsh" ]; - nativeBuildInputs = [ zip ]; + nativeBuildInputs = [ zip makeWrapper ]; + + # https://github.com/NixOS/nixpkgs/issues/120738 + patches = [ ./tsh.patch ]; 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 @@ -32,13 +43,38 @@ buildGoPackage rec { popd ''; + # Do not strip the embedded web assets dontStrip = true; - meta = { + # 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://gravitational.com/teleport/"; - license = stdenv.lib.licenses.asl20; - maintainers = with stdenv.lib.maintainers; [ sigma tomberek ]; - platforms = stdenv.lib.platforms.unix; + homepage = "https://goteleport.com/"; + license = licenses.asl20; + maintainers = with maintainers; [ sigma tomberek freezeboy ]; + platforms = platforms.unix; }; } diff --git a/pkgs/servers/teleport/tsh.patch b/pkgs/servers/teleport/tsh.patch new file mode 100644 index 00000000000..0d614f063d4 --- /dev/null +++ b/pkgs/servers/teleport/tsh.patch @@ -0,0 +1,17 @@ +diff --git a/tool/tsh/tsh.go b/tool/tsh/tsh.go +index 57379c40f..cb4d7b84c 100644 +--- a/tool/tsh/tsh.go ++++ b/tool/tsh/tsh.go +@@ -514,10 +514,11 @@ func Run(args []string, opts ...cliOption) error { + } + } + +- cf.executablePath, err = os.Executable() ++ tempBinaryPath, err := os.Executable() + if err != nil { + return trace.Wrap(err) + } ++ cf.executablePath = path.Dir(tempBinaryPath) + "/tsh" + + if err := client.ValidateAgentKeyOption(cf.AddKeysToAgent); err != nil { + return trace.Wrap(err) |