Skip to content

Commit

Permalink
teleport_16: 16.0.4 -> 16.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
justinas committed Aug 21, 2024
1 parent 8a33541 commit b4df919
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 26 deletions.
8 changes: 4 additions & 4 deletions pkgs/servers/teleport/16/default.nix
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
63 changes: 41 additions & 22 deletions pkgs/servers/teleport/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
, nodejs
, openssl
, pkg-config
, pnpm_9
, rustc
, Security
, stdenv
Expand All @@ -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 {
Expand All @@ -40,6 +43,7 @@ let
rev = "v${version}";
inherit hash;
};
pname = "teleport";
inherit version;

rdpClient = rustPlatform.buildRustPackage rec {
Expand Down Expand Up @@ -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
Expand All @@ -119,9 +135,7 @@ let
};
in
buildGoModule rec {
pname = "teleport";

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

Expand All @@ -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 ''
Expand Down
17 changes: 17 additions & 0 deletions pkgs/servers/teleport/tsh_16.patch
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit b4df919

Please sign in to comment.