Unverified Commit 7495def0 authored by tomberek's avatar tomberek Committed by GitHub
Browse files

Merge pull request #336353 from justinas/teleport-16-1-4

teleport_16: 16.0.4 -> 16.1.4
parents c50e76f6 b4df9190
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
{ wasm-bindgen-cli, ... }@args:
import ../generic.nix (args // {
  version = "16.0.4";
  hash = "sha256-svDqcYm6PbmPyHhN00VKn/sGRkfb7ah2N7BtEVdZ9hg=";
  vendorHash = "sha256-H4Rwel/UAvxY8/4CfSbneJYjt9HHgsuNbYXUM6MtqXM=";
  yarnHash = "sha256-OHNnN66MevDiH4Zr6Uq3Om65XBzf4O3AIrPvhlvhkbE=";
  version = "16.1.4";
  hash = "sha256-WgMQzS7nwIwPojcf9HTLajLd0WV+RYEbyp/aWr9XFWc=";
  vendorHash = "sha256-8WN4hVueA2o2bHhhxLGPYxPX+1qky8QHGTRqhEGNh9s=";
  pnpmHash = "sha256-phDrOSFQsgA+I4PDK9LJasUBXBO8EkVtQIMx9M4v8u0=";
  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
+41 −22
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
, nodejs
, openssl
, pkg-config
, pnpm_9
, rustc
, Security
, stdenv
@@ -30,8 +31,10 @@
, extPatches ? []
, cargoHash ? null
, cargoLock ? null
, yarnHash
, yarnHash ? null
, pnpmHash ? null
}:
assert yarnHash != null || pnpmHash != null;
let
  # This repo has a private submodule "e" which fetchgit cannot handle without failing.
  src = fetchFromGitHub {
@@ -40,6 +43,7 @@ let
    rev = "v${version}";
    inherit hash;
  };
  pname = "teleport";
  inherit version;

  rdpClient = rustPlatform.buildRustPackage rec {
@@ -76,22 +80,32 @@ let

    cargoDeps = rustPlatform.importCargoLock cargoLock;

    nativeBuildInputs = [ nodejs yarn fixup-yarn-lock ] ++
      lib.optional (lib.versionAtLeast version "15") [
    pnpmDeps = if pnpmHash != null then pnpm_9.fetchDeps {
      inherit src pname version;
      hash = pnpmHash;
    } else null;

    nativeBuildInputs = [ nodejs ] ++ lib.optional (lib.versionAtLeast version "15") [
      binaryen
      cargo
      nodejs
      rustc
      rustc.llvmPackages.lld
      rustPlatform.cargoSetupHook
      wasm-bindgen-cli
      wasm-pack
      ];
    ] ++ (if lib.versionAtLeast version "16" then [ pnpm_9.configHook ] else [ yarn fixup-yarn-lock ]);

    configurePhase = ''
      runHook preConfigure

      export HOME=$(mktemp -d)

      runHook postConfigure
    '';

    buildPhase = ''
      ${lib.optionalString (lib.versionOlder version "16") ''
        yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
        fixup-yarn-lock yarn.lock

@@ -99,10 +113,12 @@ let
          --frozen-lockfile \
          --ignore-engines --ignore-scripts
        patchShebangs .
      ''}

      PATH=$PATH:$PWD/node_modules/.bin

      ${if lib.versionAtLeast version "15"
      then ''
        PATH=$PATH:$PWD/node_modules/.bin
        pushd web/packages/teleport
        # https://github.com/gravitational/teleport/blob/6b91fe5bbb9e87db4c63d19f94ed4f7d0f9eba43/web/packages/teleport/README.md?plain=1#L18-L20
        RUST_MIN_STACK=16777216 wasm-pack build ./src/ironrdp --target web --mode no-install
@@ -119,9 +135,7 @@ let
  };
in
buildGoModule rec {
  pname = "teleport";

  inherit src version;
  inherit pname src version;
  inherit vendorHash;
  proxyVendor = true;

@@ -136,12 +150,17 @@ buildGoModule rec {
  patches = extPatches ++ [
    ./0001-fix-add-nix-path-to-exec-env.patch
    ./rdpclient.patch
    ./tsh.patch
    (if lib.versionAtLeast version "16" then ./tsh_16.patch else ./tsh.patch)
  ];

  # Reduce closure size for client machines
  outputs = [ "out" "client" ];

  prePatch = ''
    # TODO: remove after https://github.com/NixOS/nixpkgs/pull/332852 merges
    sed -i 's/go 1.22.6/go 1.22.5/' go.mod
  '';

  preBuild = ''
    cp -r ${webassets} webassets
  '' + lib.optionalString withRdpClient ''
+17 −0
Original line number Diff line number Diff line
diff --git a/tool/tsh/common/tsh.go b/tool/tsh/common/tsh.go
index 5de21c69d0..3995c19e3c 100644
--- a/tool/tsh/common/tsh.go
+++ b/tool/tsh/common/tsh.go
@@ -1084,10 +1084,11 @@ func Run(ctx context.Context, args []string, opts ...CliOption) error {
 
 	var err error
 
-	cf.executablePath, err = os.Executable()
+	tempBinaryPath, err := os.Executable()
 	if err != nil {
 		return trace.Wrap(err)
 	}
+	cf.executablePath = filepath.Dir(tempBinaryPath) + "/tsh"
 
 	// configs
 	setEnvFlags(&cf)