在vim_configurable.customize中使用python3覆盖python3
问题描述:
我在使用this模板来配置我的自定义vim和Nix。我vim-config/default.nix
如下:在vim_configurable.customize中使用python3覆盖python3
{ pkgs }:
let
my_plugins = import ./plugins.nix { inherit (pkgs) vimUtils fetchFromGitHub; };
in with (pkgs // { python = pkgs.python3; }); vim_configurable.customize {
name = "vim";
vimrcConfig = {
customRC = ''
syntax on
filetype on
" ...
'';
vam.knownPlugins = vimPlugins // my_plugins;
vam.pluginDictionaries = [
{ names = [
"ctrlp"
# ...
]; }
];
};
}
虽然有(pkgs // { python = pkgs.python3; })
覆盖在第5行,仍没有使用python3(当我运行vim --version
它显示+python -python3
)。我错过了什么?
答
事实证明,with (pkgs // { python = pkgs.python3; });
只修改python
在with
语句后面的范围内。 vim_configurable
中使用的python
不受影响。我落得这样做是让使用vimUtils.makeCustomizable
的vim_configurable
一个python3版本:
vim-config/default.nix
:
{ pkgs }:
let
my_plugins = import ./plugins.nix { inherit (pkgs) vimUtils fetchFromGitHub; };
configurable_nix_path = <nixpkgs/pkgs/applications/editors/vim/configurable.nix>;
my_vim_configurable = with pkgs; vimUtils.makeCustomizable (callPackage configurable_nix_path {
inherit (darwin.apple_sdk.frameworks) CoreServices Cocoa Foundation CoreData;
inherit (darwin) libobjc cf-private;
features = "huge"; # one of tiny, small, normal, big or huge
lua = pkgs.lua5_1;
gui = config.vim.gui or "auto";
python = python3;
# optional features by flags
flags = [ "python" "X11" ];
});
in with pkgs; my_vim_configurable.customize {
name = "vim";
vimrcConfig = {
customRC = ''
syntax on
“...
'';
vam.knownPlugins = vimPlugins // my_plugins;
vam.pluginDictionaries = [
{ names = [
"ctrlp"
# ...
]; }
];
};
}
谢谢,非常有用。删除configurable_nix_path中的双引号会导致更高效(无需警报)的评估;请参阅https://groups.google.com/forum/#!topic/nix-devel/mPyaxyRShFE –
谢谢@KlaasvanSchelven,我没有看到自己的警告,但看起来它是一个更有效的解决方案。我已经更新了答案以反映这一变化。 – Ben