1{ stdenv
2, lib
3, fetchFrom9Front
4, unstableGitUpdater
5, installShellFiles
6, makeWrapper
7, xorg
8, pkg-config
9, wayland-scanner
10, pipewire
11, wayland
12, wayland-protocols
13, libxkbcommon
14, wlr-protocols
15, pulseaudio
16, config
17}:
18
19stdenv.mkDerivation {
20 pname = "drawterm";
21 version = "unstable-2023-08-22";
22
23 src = fetchFrom9Front {
24 owner = "plan9front";
25 repo = "drawterm";
26 rev = "c91c6fac9d725716ca6ecc3002053f941137f24f";
27 hash = "sha256-oGcKRx1tP2jeshHhaCHPRKmwKQ3WPYK1tHGGt1/3oDU=";
28 };
29
30 enableParallelBuilding = true;
31 strictDeps = true;
32 nativeBuildInputs = [ installShellFiles ] ++ {
33 linux = [ pkg-config wayland-scanner ];
34 unix = [ makeWrapper ];
35 }."${config}" or (throw "unsupported CONF");
36
37 buildInputs = {
38 linux = [ pipewire wayland wayland-protocols libxkbcommon wlr-protocols ];
39 unix = [ xorg.libX11 xorg.libXt ];
40 }."${config}" or (throw "unsupported CONF");
41
42 # TODO: macos
43 makeFlags = [ "CONF=${config}" ];
44
45 installPhase = {
46 linux = ''
47 install -Dm755 -t $out/bin/ drawterm
48 '';
49 unix = ''
50 # wrapping the oss output with pulse seems to be the easiest
51 mv drawterm drawterm.bin
52 install -Dm755 -t $out/bin/ drawterm.bin
53 makeWrapper ${pulseaudio}/bin/padsp $out/bin/drawterm --add-flags $out/bin/drawterm.bin
54 '';
55 }."${config}" or (throw "unsupported CONF") + ''
56 installManPage drawterm.1
57 '';
58
59 passthru.updateScript = unstableGitUpdater { shallowClone = false; };
60
61 meta = with lib; {
62 description = "Connect to Plan 9 CPU servers from other operating systems.";
63 homepage = "https://drawterm.9front.org/";
64 license = licenses.mit;
65 maintainers = with maintainers; [ luc65r moody ];
66 platforms = platforms.linux;
67 mainProgram = "drawterm";
68 };
69}