Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 97 lines 2.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 callPackage, 6 ncurses, 7 bash, 8 gawk, 9 gettext, 10 pkg-config, 11 # default vimrc 12 vimrc ? fetchurl { 13 name = "default-vimrc"; 14 url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/68f6d131750aa778807119e03eed70286a17b1cb/trunk/archlinux.vim"; 15 sha256 = "18ifhv5q9prd175q3vxbqf6qyvkk6bc7d2lhqdk0q78i68kv9y0c"; 16 }, 17}: 18 19let 20 common = callPackage ./common.nix { }; 21in 22stdenv.mkDerivation { 23 pname = "vim"; 24 25 inherit (common) 26 version 27 outputs 28 src 29 postPatch 30 hardeningDisable 31 enableParallelBuilding 32 enableParallelInstalling 33 postFixup 34 meta 35 ; 36 37 nativeBuildInputs = [ 38 gettext 39 pkg-config 40 ]; 41 buildInputs = [ 42 ncurses 43 bash 44 gawk 45 ]; 46 47 strictDeps = true; 48 49 configureFlags = [ 50 "--enable-multibyte" 51 "--enable-nls" 52 ] 53 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) ( 54 [ 55 "vim_cv_toupper_broken=no" 56 "--with-tlib=ncurses" 57 "vim_cv_terminfo=yes" 58 "vim_cv_tgetent=zero" # it does on native anyway 59 "vim_cv_tty_group=tty" 60 "vim_cv_tty_mode=0660" 61 "vim_cv_getcwd_broken=no" 62 "vim_cv_stat_ignores_slash=yes" 63 "vim_cv_memmove_handles_overlap=yes" 64 ] 65 ++ lib.optionals stdenv.hostPlatform.isFreeBSD [ 66 "vim_cv_timer_create=no" 67 "vim_cv_timer_create_with_lrt=yes" 68 ] 69 ++ lib.optionals (!stdenv.hostPlatform.isFreeBSD) [ 70 "vim_cv_timer_create=yes" 71 ] 72 ); 73 74 # which.sh is used to for vim's own shebang patching, so make it find 75 # binaries for the host platform. 76 preConfigure = '' 77 export HOST_PATH 78 substituteInPlace src/which.sh --replace '$PATH' '$HOST_PATH' 79 ''; 80 81 postInstall = '' 82 ln -s $out/bin/vim $out/bin/vi 83 mkdir -p $out/share/vim 84 cp "${vimrc}" $out/share/vim/vimrc 85 86 # Prevent bugs in the upstream makefile from silently failing and missing outputs. 87 # Some of those are build-time requirements for other packages. 88 for tool in ex xxd vi view vimdiff; do 89 if [ ! -e "$out/bin/$tool" ]; then 90 echo "ERROR: install phase did not install '$tool'." 91 exit 1 92 fi 93 done 94 ''; 95 96 __impureHostDeps = [ "/dev/ptmx" ]; 97}