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