1{
2 lib,
3 stdenv,
4 fetchgit,
5 SDL2,
6 alsa-lib,
7 babl,
8 bash,
9 curl,
10 libdrm, # Not documented
11 pkg-config,
12 xxd,
13 enableFb ? false,
14 nixosTests,
15}:
16
17stdenv.mkDerivation (finalAttrs: {
18 pname = "ctx";
19 version = "unstable-2023-09-03";
20
21 src = fetchgit {
22 name = "ctx-source"; # because of a dash starting the directory
23 url = "https://ctx.graphics/.git/";
24 rev = "1bac18c152eace3ca995b3c2b829a452085d46fb";
25 hash = "sha256-fOcQJ2XCeomdtAUmy0A+vU7Vt325OSwrb1+ccW+gZ38=";
26 };
27
28 patches = [
29 # Many problematic things fixed - it should be upstreamed somehow:
30 # - babl changed its name in pkg-config files
31 # - arch detection made optional
32 # - LD changed to CCC
33 # - remove inexistent reference to static/*/*
34 ./0001-fix-detections.diff
35 ];
36
37 postPatch = ''
38 patchShebangs ./tools/gen_fs.sh
39 '';
40
41 nativeBuildInputs = [
42 pkg-config
43 xxd
44 ];
45
46 buildInputs = [
47 SDL2
48 alsa-lib
49 babl
50 bash # for ctx-audioplayer
51 curl
52 libdrm
53 ];
54
55 strictDeps = true;
56
57 env.ARCH = stdenv.hostPlatform.parsed.cpu.arch;
58
59 configureScript = "./configure.sh";
60 configureFlags = lib.optional enableFb "--enable-fb";
61 configurePlatforms = [ ];
62 dontAddPrefix = true;
63 dontDisableStatic = true;
64
65 installFlags = [
66 "PREFIX=${placeholder "out"}"
67 ];
68
69 passthru.tests.test = nixosTests.terminal-emulators.ctx;
70
71 meta = {
72 homepage = "https://ctx.graphics/";
73 description = "Vector graphics terminal";
74 longDescription = ''
75 ctx is an interactive 2D vector graphics, audio, text- canvas and
76 terminal, with escape sequences that enable a 2D vector drawing API using
77 a vector graphics protocol.
78 '';
79 license = lib.licenses.gpl3Plus;
80 maintainers = with lib.maintainers; [ ];
81 platforms = lib.platforms.unix;
82 };
83})