aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/home-manager/tests/modules/programs/neovim/plugin-config.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/home-manager/tests/modules/programs/neovim/plugin-config.nix')
-rw-r--r--infra/libkookie/home-manager/tests/modules/programs/neovim/plugin-config.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/infra/libkookie/home-manager/tests/modules/programs/neovim/plugin-config.nix b/infra/libkookie/home-manager/tests/modules/programs/neovim/plugin-config.nix
new file mode 100644
index 000000000000..60edaee82c22
--- /dev/null
+++ b/infra/libkookie/home-manager/tests/modules/programs/neovim/plugin-config.nix
@@ -0,0 +1,37 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ config = {
+ programs.neovim = {
+ enable = true;
+ extraConfig = ''
+ " This should be present in vimrc
+ '';
+ plugins = with pkgs.vimPlugins; [
+ vim-nix
+ {
+ plugin = vim-commentary;
+ config = ''
+ " This should be present too
+ autocmd FileType c setlocal commentstring=//\ %s
+ autocmd FileType c setlocal comments=://
+ '';
+ }
+ ];
+ };
+
+ nmt.script = ''
+ vimrc=$(grep -Po "(?<=-u )[^ ]*" < "${
+ builtins.toJSON config.programs.neovim.finalPackage
+ }/bin/nvim")
+ # We need to remove the unkown store paths in the config
+ TESTED="" assertFileContent \
+ <( ${pkgs.perl}/bin/perl -pe "s|\Q$NIX_STORE\E/[a-z0-9]{32}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" < "$vimrc"
+ ) \
+ "${./plugin-config.vim}"
+ '';
+ };
+}
+