nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 writableTmpDirAsHomeHook,
7 installShellFiles,
8 nixosTests,
9}:
10
11buildGoModule (finalAttrs: {
12 pname = "upterm";
13 version = "0.20.0";
14
15 src = fetchFromGitHub {
16 owner = "owenthereal";
17 repo = "upterm";
18 rev = "v${finalAttrs.version}";
19 hash = "sha256-qTw8bYROAAB7FwKCCQamIbWGbqSexXl87DdvSNsFZ/I=";
20 };
21
22 vendorHash = "sha256-5OAS7s9A95h5LihXgOwkOXAMylS7g+lqjaI3MKTvlW0=";
23
24 subPackages = [
25 "cmd/upterm"
26 "cmd/uptermd"
27 ];
28
29 nativeBuildInputs = [
30 writableTmpDirAsHomeHook
31 installShellFiles
32 ];
33
34 postInstall = ''
35 # force go to build for build arch rather than host arch during cross-compiling
36 CGO_ENABLED=0 GOOS= GOARCH= go run cmd/gendoc/main.go
37 installManPage etc/man/man*/*
38 ''
39 + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
40 for cmd in upterm uptermd; do
41 installShellCompletion --cmd $cmd \
42 --bash <($out/bin/$cmd completion bash) \
43 --fish <($out/bin/$cmd completion fish) \
44 --zsh <($out/bin/$cmd completion zsh)
45 done
46 '';
47
48 doCheck = true;
49
50 passthru.tests = { inherit (nixosTests) uptermd; };
51
52 __darwinAllowLocalNetworking = true;
53
54 meta = {
55 description = "Secure terminal-session sharing";
56 homepage = "https://upterm.dev";
57 license = lib.licenses.asl20;
58 maintainers = with lib.maintainers; [ hax404 ];
59 };
60})