|
30 | 30 | performance.byteCompileLua.enable = true; |
31 | 31 |
|
32 | 32 | extraFiles = { |
| 33 | + # By text |
33 | 34 | "plugin/file_text.lua".text = "vim.opt.tabstop = 2"; |
| 35 | + # By simple source derivation using buildCommand |
34 | 36 | "plugin/file_source.lua".source = helpers.writeLua "file_source.lua" "vim.opt.tabstop = 2"; |
| 37 | + # By standard derivation, it needs to execute fixupPhase |
| 38 | + "plugin/file_drv.lua".source = pkgs.stdenvNoCC.mkDerivation { |
| 39 | + name = "file_drv.lua"; |
| 40 | + src = pkgs.emptyDirectory; |
| 41 | + buildPhase = '' |
| 42 | + echo "vim.opt.tabstop = 2" > $out |
| 43 | + ''; |
| 44 | + }; |
| 45 | + # By path |
| 46 | + "plugin/file_path.lua".source = ./files/file.lua; |
| 47 | + # By string |
| 48 | + "plugin/file_string.lua".source = builtins.toFile "file_path.lua" "vim.opt.tabstop = 2"; |
| 49 | + # By derivation converted to string |
| 50 | + "plugin/file_drv_string.lua".source = toString ( |
| 51 | + helpers.writeLua "file_drv_string.lua" "vim.opt.tabstop = 2" |
| 52 | + ); |
| 53 | + # Non-lua files |
35 | 54 | "plugin/test.vim".text = "set tabstop=2"; |
36 | 55 | "plugin/test.json".text = builtins.toJSON { a = 1; }; |
| 56 | + # Lua file with txt extension won't be byte compiled |
| 57 | + "test.txt".source = helpers.writeLua "test.txt" "vim.opt.tabstop = 2"; |
37 | 58 | }; |
38 | 59 |
|
39 | 60 | files = { |
|
64 | 85 | local init_content = vim.fn.system("${config.printInitPackage}/bin/nixvim-print-init") |
65 | 86 | assert(init_content:find("VALIDATING_STRING"), "nixvim-print-init's output is byte compiled") |
66 | 87 |
|
67 | | - -- extraFiles |
68 | | - test_rtp_file("plugin/file_text.lua", false) |
69 | | - test_rtp_file("plugin/file_source.lua", false) |
| 88 | + -- lua extraFiles are byte compiled |
| 89 | + test_rtp_file("plugin/file_text.lua", true) |
| 90 | + test_rtp_file("plugin/file_source.lua", true) |
| 91 | + test_rtp_file("plugin/file_drv.lua", true) |
| 92 | + test_rtp_file("plugin/file_path.lua", true) |
| 93 | + test_rtp_file("plugin/file_string.lua", true) |
| 94 | + test_rtp_file("plugin/file_drv_string.lua", true) |
70 | 95 | test_rtp_file("plugin/test.vim", false) |
71 | 96 | test_rtp_file("plugin/test.json", false) |
| 97 | + test_rtp_file("test.txt", false) |
72 | 98 |
|
73 | | - -- files |
74 | | - test_rtp_file("plugin/file.lua", false) |
| 99 | + -- lua files are byte compiled |
| 100 | + test_rtp_file("plugin/file.lua", true) |
75 | 101 | test_rtp_file("plugin/file.vim", false) |
76 | 102 |
|
77 | 103 | -- Plugins and neovim runtime aren't byte compiled by default |
|
136 | 162 | assert(not is_byte_compiled(init), "MYVIMRC is not expected to be byte compiled, but it is") |
137 | 163 | ''; |
138 | 164 | }; |
| 165 | + |
| 166 | + configs-disabled = { |
| 167 | + performance.byteCompileLua = { |
| 168 | + enable = true; |
| 169 | + configs = false; |
| 170 | + }; |
| 171 | + |
| 172 | + extraFiles."plugin/test1.lua".text = "vim.opt.tabstop = 2"; |
| 173 | + |
| 174 | + files."plugin/test2.lua".opts.tabstop = 2; |
| 175 | + |
| 176 | + extraConfigLuaPost = '' |
| 177 | + ${isByteCompiledFun} |
| 178 | +
|
| 179 | + -- extraFiles |
| 180 | + test_rtp_file("plugin/test1.lua", false) |
| 181 | + -- files |
| 182 | + test_rtp_file("plugin/test2.lua", false) |
| 183 | + ''; |
| 184 | + }; |
139 | 185 | } |
0 commit comments