about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/terminal-emulators/contour/default.nix
blob: a01975a73ef3348d4a8f00dc1e07995668aa8ac8 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{ lib
, stdenv
, fetchFromGitHub
, fetchurl
, cmake
, pkg-config
, boxed-cpp
, freetype
, fontconfig
, libunicode
, libutempter
, termbench-pro
, qtmultimedia
, qt5compat
, wrapQtAppsHook
, pcre
, boost
, catch2
, fmt
, microsoft-gsl
, range-v3
, yaml-cpp
, ncurses
, file
, utmp
, sigtool
, nixosTests
, installShellFiles
}:

stdenv.mkDerivation (final: {
  pname = "contour";
  version = "0.4.0.6245";

  src = fetchFromGitHub {
    owner = "contour-terminal";
    repo = "contour";
    rev = "v${final.version}";
    hash = "sha256-0A3fGbQPfzV4V4f5GGyjbQLJK+tX7ZVerAL7TkHhjdo=";
  };

  patches = [ ./dont-fix-app-bundle.diff ];

  outputs = [ "out" "terminfo" ];

  nativeBuildInputs = [
    cmake
    pkg-config
    ncurses
    file
    wrapQtAppsHook
    installShellFiles
  ] ++ lib.optionals stdenv.isDarwin [ sigtool ];

  buildInputs = [
    boxed-cpp
    fontconfig
    freetype
    libunicode
    termbench-pro
    qtmultimedia
    qt5compat
    pcre
    boost
    catch2
    fmt
    microsoft-gsl
    range-v3
    yaml-cpp
  ]
  ++ lib.optionals stdenv.isLinux [ libutempter ]
  ++ lib.optionals stdenv.isDarwin [ utmp ];

  cmakeFlags = [ "-DCONTOUR_QT_VERSION=6" ];

  postInstall = ''
    mkdir -p $out/nix-support $terminfo/share
  '' + lib.optionalString stdenv.isDarwin ''
    mkdir $out/Applications
    installShellCompletion --zsh $out/contour.app/Contents/Resources/shell-integration/shell-integration.zsh
    installShellCompletion --fish $out/contour.app/Contents/Resources/shell-integration/shell-integration.fish
    cp -r $out/contour.app/Contents/Resources/terminfo $terminfo/share
    mv $out/contour.app $out/Applications
    ln -s $out/bin $out/Applications/contour.app/Contents/MacOS
  '' + lib.optionalString stdenv.isLinux ''
    mv $out/share/terminfo $terminfo/share/
    installShellCompletion --zsh $out/share/contour/shell-integration/shell-integration.zsh
    installShellCompletion --fish $out/share/contour/shell-integration/shell-integration.fish
  '' + ''
    echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
  '';

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

  meta = with lib; {
    description = "Modern C++ Terminal Emulator";
    homepage = "https://github.com/contour-terminal/contour";
    changelog = "https://github.com/contour-terminal/contour/raw/v${version}/Changelog.md";
    license = licenses.asl20;
    maintainers = with maintainers; [ moni ];
    platforms = platforms.unix;
    mainProgram = "contour";
  };
})