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:
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 = {

View File

@ -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,33 +80,45 @@ let
cargoDeps = rustPlatform.importCargoLock cargoLock;
nativeBuildInputs = [ nodejs yarn fixup-yarn-lock ] ++
lib.optional (lib.versionAtLeast version "15") [
binaryen
cargo
rustc
rustc.llvmPackages.lld
rustPlatform.cargoSetupHook
wasm-bindgen-cli
wasm-pack
];
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 = ''
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
fixup-yarn-lock yarn.lock
${lib.optionalString (lib.versionOlder version "16") ''
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
fixup-yarn-lock yarn.lock
yarn install --offline \
--frozen-lockfile \
--ignore-engines --ignore-scripts
patchShebangs .
yarn install --offline \
--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 ''

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)