about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/ct/ctx/package.nix
blob: b329fd221247ba48291ca3e3eaeb86f4a5ec517f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{ lib
, stdenv
, fetchgit
, SDL2
, alsa-lib
, babl
, bash
, curl
, libdrm # Not documented
, pkg-config
, xxd
, enableFb ? false
, nixosTests
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "ctx";
  version = "unstable-2023-09-03";

  src = fetchgit {
    name = "ctx-source"; # because of a dash starting the directory
    url = "https://ctx.graphics/.git/";
    rev = "1bac18c152eace3ca995b3c2b829a452085d46fb";
    hash = "sha256-fOcQJ2XCeomdtAUmy0A+vU7Vt325OSwrb1+ccW+gZ38=";
  };

  patches = [
    # Many problematic things fixed - it should be upstreamed somehow:
    # - babl changed its name in pkg-config files
    # - arch detection made optional
    # - LD changed to CCC
    # - remove inexistent reference to static/*/*
    ./0001-fix-detections.diff
  ];

  postPatch = ''
    patchShebangs ./tools/gen_fs.sh
  '';

  nativeBuildInputs = [
    pkg-config
    xxd
  ];

  buildInputs = [
    SDL2
    alsa-lib
    babl
    bash # for ctx-audioplayer
    curl
    libdrm
  ];

  strictDeps = true;

  env.ARCH = stdenv.hostPlatform.parsed.cpu.arch;

  configureScript = "./configure.sh";
  configureFlags = lib.optional enableFb "--enable-fb";
  configurePlatforms = [];
  dontAddPrefix = true;
  dontDisableStatic = true;

  installFlags = [
    "PREFIX=${placeholder "out"}"
  ];

  passthru.tests.test = nixosTests.terminal-emulators.ctx;

  meta = {
    homepage = "https://ctx.graphics/";
    description = "Vector graphics terminal";
    longDescription = ''
      ctx is an interactive 2D vector graphics, audio, text- canvas and
      terminal, with escape sequences that enable a 2D vector drawing API using
      a vector graphics protocol.
    '';
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [ AndersonTorres ];
    platforms = lib.platforms.unix;
  };
})