Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 112 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 pkg-config, 7 vte, 8 gtk3, 9 ncurses, 10 pcre2, 11 wrapGAppsHook3, 12 nixosTests, 13}: 14 15let 16 17 # termite requires VTE with some internals exposed 18 # https://github.com/thestinger/vte-ng 19 # 20 # three of the patches have been locally modified to cleanly apply on 0.62 21 vte-ng = vte.overrideAttrs (attrs: { 22 patches = attrs.patches or [ ] ++ [ 23 (fetchpatch { 24 name = "0001-expose-functions-for-pausing-unpausing-output.patch"; 25 url = "https://github.com/thestinger/vte-ng/commit/342e26574f50dcd40bbeaad9e839c2a6144d0c1c.patch"; 26 sha256 = "1b0k9ys545q85vfki417p21kis9f36yd0hyp12phayynss6fn715"; 27 }) 28 # Derived from https://github.com/thestinger/vte-ng/commit/5ae3acb69474fe5bc43767a4a3625e9ed23607a1.patch 29 ./vte-ng-modified-patches/vte-0002-expose-function-for-setting-cursor-position.patch 30 # Derived from https://github.com/thestinger/vte-ng/commit/742d57ecf15e24f6a5f2133a81b6c70acc8ff03c.patch 31 ./vte-ng-modified-patches/vte-0003-add-function-for-setting-the-text-selections.patch 32 (fetchpatch { 33 name = "0004-add-functions-to-get-set-block-selection-mode.patch"; 34 url = "https://github.com/thestinger/vte-ng/commit/08748fd9cb82bd191e5c476b1682ca71f7732572.patch"; 35 sha256 = "1cnhd8f7ywdgcyd6xmcd2nn39jjxzkxp4d0zsj2k7m5v74nhcs1g"; 36 }) 37 # Derived from "https://github.com/thestinger/vte-ng/commit/dd74ae7c06e8888af2fc090ac6f8920a9d8227fb.patch"; 38 ./vte-ng-modified-patches/vte-0005-expose-function-for-getting-the-selected-text.patch 39 ]; 40 }); 41 42in 43stdenv.mkDerivation rec { 44 pname = "termite"; 45 version = "15"; 46 47 src = fetchFromGitHub { 48 owner = "thestinger"; 49 repo = "termite"; 50 rev = "v${version}"; 51 sha256 = "0hp1x6lj098m3jgna274wv5dv60lnzg22297di68g4hw9djjyd2k"; 52 fetchSubmodules = true; 53 }; 54 55 # https://github.com/thestinger/termite/pull/516 56 patches = [ 57 ./url_regexp_trailing.patch 58 ./add_errno_header.patch 59 # Fix off-by-one in select_text() on libvte >= 0.55.0 60 # Expected to be included in next release (16). 61 (fetchpatch { 62 url = "https://github.com/thestinger/termite/commit/7e9a93b421b9596f8980645a46ac2ad5468dac06.patch"; 63 sha256 = "0vph2m5919f7w1xnc8i6z0j44clsm1chxkfg7l71nahxyfw5yh4j"; 64 }) 65 ] 66 ++ lib.optional stdenv.hostPlatform.isDarwin ./remove_ldflags_macos.patch; 67 68 makeFlags = [ 69 "VERSION=v${version}" 70 "PREFIX=" 71 "DESTDIR=$(out)" 72 ]; 73 74 buildInputs = [ 75 vte-ng 76 gtk3 77 ncurses 78 pcre2 79 ]; 80 81 nativeBuildInputs = [ 82 wrapGAppsHook3 83 pkg-config 84 ]; 85 86 outputs = [ 87 "out" 88 "terminfo" 89 ]; 90 91 passthru = { 92 inherit vte-ng; 93 tests = nixosTests.terminal-emulators.termite; 94 }; 95 96 postInstall = '' 97 mkdir -p $terminfo/share 98 mv $out/share/terminfo $terminfo/share/terminfo 99 100 mkdir -p $out/nix-support 101 echo "$terminfo" >> $out/nix-support/propagated-user-env-packages 102 ''; 103 104 meta = with lib; { 105 description = "Simple VTE-based terminal"; 106 license = licenses.lgpl2Plus; 107 homepage = "https://github.com/thestinger/termite/"; 108 maintainers = with maintainers; [ koral ]; 109 platforms = platforms.all; 110 mainProgram = "termite"; 111 }; 112}