{ lib, stdenv, buildGoModule, fetchFromGitHub, writableTmpDirAsHomeHook, installShellFiles, nixosTests, }: buildGoModule (finalAttrs: { pname = "upterm"; version = "0.20.0"; src = fetchFromGitHub { owner = "owenthereal"; repo = "upterm"; rev = "v${finalAttrs.version}"; hash = "sha256-qTw8bYROAAB7FwKCCQamIbWGbqSexXl87DdvSNsFZ/I="; }; vendorHash = "sha256-5OAS7s9A95h5LihXgOwkOXAMylS7g+lqjaI3MKTvlW0="; subPackages = [ "cmd/upterm" "cmd/uptermd" ]; nativeBuildInputs = [ writableTmpDirAsHomeHook installShellFiles ]; postInstall = '' # force go to build for build arch rather than host arch during cross-compiling CGO_ENABLED=0 GOOS= GOARCH= go run cmd/gendoc/main.go installManPage etc/man/man*/* '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' for cmd in upterm uptermd; do installShellCompletion --cmd $cmd \ --bash <($out/bin/$cmd completion bash) \ --fish <($out/bin/$cmd completion fish) \ --zsh <($out/bin/$cmd completion zsh) done ''; doCheck = true; passthru.tests = { inherit (nixosTests) uptermd; }; __darwinAllowLocalNetworking = true; meta = { description = "Secure terminal-session sharing"; homepage = "https://upterm.dev"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ hax404 ]; }; })