teleport_16: 16.0.4 -> 16.1.4

This commit is contained in:
Justinas Stankevicius 2024-08-08 14:15:04 +03:00
parent 8a3354191c
commit b4df919002
3 changed files with 62 additions and 26 deletions

View File

@ -1,9 +1,9 @@
{ wasm-bindgen-cli, ... }@args: { wasm-bindgen-cli, ... }@args:
import ../generic.nix (args // { import ../generic.nix (args // {
version = "16.0.4"; version = "16.1.4";
hash = "sha256-svDqcYm6PbmPyHhN00VKn/sGRkfb7ah2N7BtEVdZ9hg="; hash = "sha256-WgMQzS7nwIwPojcf9HTLajLd0WV+RYEbyp/aWr9XFWc=";
vendorHash = "sha256-H4Rwel/UAvxY8/4CfSbneJYjt9HHgsuNbYXUM6MtqXM="; vendorHash = "sha256-8WN4hVueA2o2bHhhxLGPYxPX+1qky8QHGTRqhEGNh9s=";
yarnHash = "sha256-OHNnN66MevDiH4Zr6Uq3Om65XBzf4O3AIrPvhlvhkbE="; pnpmHash = "sha256-phDrOSFQsgA+I4PDK9LJasUBXBO8EkVtQIMx9M4v8u0=";
cargoLock = { cargoLock = {
lockFile = ./Cargo.lock; lockFile = ./Cargo.lock;
outputHashes = { outputHashes = {

View File

@ -12,6 +12,7 @@
, nodejs , nodejs
, openssl , openssl
, pkg-config , pkg-config
, pnpm_9
, rustc , rustc
, Security , Security
, stdenv , stdenv
@ -30,8 +31,10 @@
, extPatches ? [] , extPatches ? []
, cargoHash ? null , cargoHash ? null
, cargoLock ? null , cargoLock ? null
, yarnHash , yarnHash ? null
, pnpmHash ? null
}: }:
assert yarnHash != null || pnpmHash != null;
let let
# This repo has a private submodule "e" which fetchgit cannot handle without failing. # This repo has a private submodule "e" which fetchgit cannot handle without failing.
src = fetchFromGitHub { src = fetchFromGitHub {
@ -40,6 +43,7 @@ let
rev = "v${version}"; rev = "v${version}";
inherit hash; inherit hash;
}; };
pname = "teleport";
inherit version; inherit version;
rdpClient = rustPlatform.buildRustPackage rec { rdpClient = rustPlatform.buildRustPackage rec {
@ -76,33 +80,45 @@ let
cargoDeps = rustPlatform.importCargoLock cargoLock; cargoDeps = rustPlatform.importCargoLock cargoLock;
nativeBuildInputs = [ nodejs yarn fixup-yarn-lock ] ++ pnpmDeps = if pnpmHash != null then pnpm_9.fetchDeps {
lib.optional (lib.versionAtLeast version "15") [ inherit src pname version;
binaryen hash = pnpmHash;
cargo } else null;
rustc
rustc.llvmPackages.lld nativeBuildInputs = [ nodejs ] ++ lib.optional (lib.versionAtLeast version "15") [
rustPlatform.cargoSetupHook binaryen
wasm-bindgen-cli cargo
wasm-pack 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 = '' configurePhase = ''
runHook preConfigure
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
runHook postConfigure
''; '';
buildPhase = '' buildPhase = ''
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache} ${lib.optionalString (lib.versionOlder version "16") ''
fixup-yarn-lock yarn.lock yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
fixup-yarn-lock yarn.lock
yarn install --offline \ yarn install --offline \
--frozen-lockfile \ --frozen-lockfile \
--ignore-engines --ignore-scripts --ignore-engines --ignore-scripts
patchShebangs . patchShebangs .
''}
PATH=$PATH:$PWD/node_modules/.bin
${if lib.versionAtLeast version "15" ${if lib.versionAtLeast version "15"
then '' then ''
PATH=$PATH:$PWD/node_modules/.bin
pushd web/packages/teleport pushd web/packages/teleport
# https://github.com/gravitational/teleport/blob/6b91fe5bbb9e87db4c63d19f94ed4f7d0f9eba43/web/packages/teleport/README.md?plain=1#L18-L20 # 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 RUST_MIN_STACK=16777216 wasm-pack build ./src/ironrdp --target web --mode no-install
@ -119,9 +135,7 @@ let
}; };
in in
buildGoModule rec { buildGoModule rec {
pname = "teleport"; inherit pname src version;
inherit src version;
inherit vendorHash; inherit vendorHash;
proxyVendor = true; proxyVendor = true;
@ -136,12 +150,17 @@ buildGoModule rec {
patches = extPatches ++ [ patches = extPatches ++ [
./0001-fix-add-nix-path-to-exec-env.patch ./0001-fix-add-nix-path-to-exec-env.patch
./rdpclient.patch ./rdpclient.patch
./tsh.patch (if lib.versionAtLeast version "16" then ./tsh_16.patch else ./tsh.patch)
]; ];
# Reduce closure size for client machines # Reduce closure size for client machines
outputs = [ "out" "client" ]; 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 = '' preBuild = ''
cp -r ${webassets} webassets cp -r ${webassets} webassets
'' + lib.optionalString withRdpClient '' '' + lib.optionalString withRdpClient ''

View File

@ -0,0 +1,17 @@
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)