2020-09-25 02:08:39 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
config = {
|
|
|
|
programs.neovim = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = ''
|
neovim: Source neovimRcContent directly from store (#3444)
The previous version linked the file into home, then sourced that. Since
nothing else expects that file to be there, this is unnecessary.
Additionally, doing so made it impossible to test a built config without
switching, e.g. using `XDG_CONFIG_HOME=… nvim` or `nvim -u`. This
remedies that, at least for this particular reference.
To test this, change from asserting contents of the config file to
actually starting nvim, outputting sentinel values, and then asserting
their values are present. This way it’s tested that nvim loaded the
config, rather than that some config is in a specific place.
This is all in one commit as the test, as written now, would not have
worked before since the previously hard-coded home path was not an
actual file in the test environment.
2022-11-30 17:19:31 +01:00
|
|
|
let g:hmExtraConfig='HM_EXTRA_CONFIG'
|
2020-09-25 02:08:39 +02:00
|
|
|
'';
|
|
|
|
plugins = with pkgs.vimPlugins; [
|
|
|
|
vim-nix
|
|
|
|
{
|
|
|
|
plugin = vim-commentary;
|
|
|
|
config = ''
|
neovim: Source neovimRcContent directly from store (#3444)
The previous version linked the file into home, then sourced that. Since
nothing else expects that file to be there, this is unnecessary.
Additionally, doing so made it impossible to test a built config without
switching, e.g. using `XDG_CONFIG_HOME=… nvim` or `nvim -u`. This
remedies that, at least for this particular reference.
To test this, change from asserting contents of the config file to
actually starting nvim, outputting sentinel values, and then asserting
their values are present. This way it’s tested that nvim loaded the
config, rather than that some config is in a specific place.
This is all in one commit as the test, as written now, would not have
worked before since the previously hard-coded home path was not an
actual file in the test environment.
2022-11-30 17:19:31 +01:00
|
|
|
let g:hmPlugins='HM_PLUGINS_CONFIG'
|
2020-09-25 02:08:39 +02:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
2022-02-16 16:38:10 +01:00
|
|
|
extraLuaPackages = [ pkgs.lua51Packages.luautf8 ];
|
2020-09-25 02:08:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nmt.script = ''
|
neovim: Source neovimRcContent directly from store (#3444)
The previous version linked the file into home, then sourced that. Since
nothing else expects that file to be there, this is unnecessary.
Additionally, doing so made it impossible to test a built config without
switching, e.g. using `XDG_CONFIG_HOME=… nvim` or `nvim -u`. This
remedies that, at least for this particular reference.
To test this, change from asserting contents of the config file to
actually starting nvim, outputting sentinel values, and then asserting
their values are present. This way it’s tested that nvim loaded the
config, rather than that some config is in a specific place.
This is all in one commit as the test, as written now, would not have
worked before since the previously hard-coded home path was not an
actual file in the test environment.
2022-11-30 17:19:31 +01:00
|
|
|
vimout=$(mktemp)
|
|
|
|
echo "redir >> /dev/stdout | echo g:hmExtraConfig | echo g:hmPlugins | redir END" \
|
|
|
|
| ${pkgs.neovim}/bin/nvim -es -u "$TESTED/home-files/.config/nvim/init.lua" \
|
|
|
|
> "$vimout"
|
|
|
|
assertFileContains "$vimout" "HM_EXTRA_CONFIG"
|
|
|
|
assertFileContains "$vimout" "HM_PLUGINS_CONFIG"
|
2020-09-25 02:08:39 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|