25 , withRdpClient ? true
36 # This repo has a private submodule "e" which fetchgit cannot handle without failing.
37 src = fetchFromGitHub {
38 owner = "gravitational";
45 rdpClient = rustPlatform.buildRustPackage rec {
46 pname = "teleport-rdpclient";
47 inherit cargoHash cargoLock;
50 buildAndTestSubdir = "lib/srv/desktop/rdp/rdpclient";
52 buildInputs = [ openssl ]
53 ++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ];
54 nativeBuildInputs = [ pkg-config ];
56 # https://github.com/NixOS/nixpkgs/issues/161570 ,
57 # buildRustPackage sets strictDeps = true;
58 nativeCheckInputs = buildInputs;
60 OPENSSL_NO_VENDOR = "1";
64 cp ${buildAndTestSubdir}/librdprs.h $out/include/
68 yarnOfflineCache = fetchYarnDeps {
69 yarnLock = "${src}/yarn.lock";
73 webassets = stdenv.mkDerivation {
74 pname = "teleport-webassets";
77 cargoDeps = rustPlatform.importCargoLock cargoLock;
79 RUSTFLAGS = builtins.concatStringsSep " " [
83 nativeBuildInputs = [ nodejs yarn fixup-yarn-lock ] ++
84 lib.optional (lib.versionAtLeast version "15") [
88 rustc.llvmPackages.lld
89 rustPlatform.cargoSetupHook
95 export HOME=$(mktemp -d)
99 yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
100 fixup-yarn-lock yarn.lock
102 yarn install --offline \
104 --ignore-engines --ignore-scripts
107 ${if lib.versionAtLeast version "15"
109 PATH=$PATH:$PWD/node_modules/.bin
110 pushd web/packages/teleport
111 # https://github.com/gravitational/teleport/blob/6b91fe5bbb9e87db4c63d19f94ed4f7d0f9eba43/web/packages/teleport/README.md?plain=1#L18-L20
112 RUST_MIN_STACK=16777216 wasm-pack build ./src/ironrdp --target web --mode no-install
116 else "yarn build-ui-oss"}
121 cp -R webassets/. $out
132 subPackages = [ "tool/tbot" "tool/tctl" "tool/teleport" "tool/tsh" ];
133 tags = [ "libfido2" "webassets_embed" ]
134 ++ lib.optional withRdpClient "desktop_access_rdp";
136 buildInputs = [ openssl libfido2 ]
137 ++ lib.optionals (stdenv.isDarwin && withRdpClient) [ CoreFoundation Security AppKit ];
138 nativeBuildInputs = [ makeWrapper pkg-config ];
140 patches = extPatches ++ [
141 ./0001-fix-add-nix-path-to-exec-env.patch
145 # Reduce closure size for client machines
146 outputs = [ "out" "client" ];
149 cp -r ${webassets} webassets
150 '' + lib.optionalString withRdpClient ''
151 ln -s ${rdpClient}/lib/* lib/
152 ln -s ${rdpClient}/include/* lib/srv/desktop/rdp/rdpclient/
155 # Multiple tests fail in the build sandbox
156 # due to trying to spawn nixbld's shell (/noshell), etc.
161 mv {$out,$client}/bin/tsh
162 # make xdg-open overrideable at runtime
163 wrapProgram $client/bin/tsh --suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
164 ln -s {$client,$out}/bin/tsh
167 doInstallCheck = true;
169 installCheckPhase = ''
170 $out/bin/tsh version | grep ${version} > /dev/null
171 $client/bin/tsh version | grep ${version} > /dev/null
172 $out/bin/tbot version | grep ${version} > /dev/null
173 $out/bin/tctl version | grep ${version} > /dev/null
174 $out/bin/teleport version | grep ${version} > /dev/null
177 passthru.tests = nixosTests.teleport;
180 description = "Certificate authority and access plane for SSH, Kubernetes, web applications, and databases";
181 homepage = "https://goteleport.com/";
182 license = if lib.versionAtLeast version "15" then licenses.agpl3Plus else licenses.asl20;
183 maintainers = with maintainers; [ arianvp justinas sigma tomberek freezeboy techknowlogick ];
184 platforms = platforms.unix;
185 # go-libfido2 is broken on platforms with less than 64-bit because it defines an array
186 # which occupies more than 31 bits of address space.
187 broken = stdenv.hostPlatform.parsed.cpu.bits < 64;