diff --git a/modules/output.nix b/modules/output.nix index 44f0d18a..866d80ec 100644 --- a/modules/output.nix +++ b/modules/output.nix @@ -86,6 +86,12 @@ in { description = "Extra lua packages to include with neovim"; default = _: []; }; + + extraFiles = mkOption { + type = types.attrsOf types.str; + description = "Extra files to add to the runtime path"; + default = {}; + }; }; config = let diff --git a/tests/test-sources/modules/extra-files.nix b/tests/test-sources/modules/extra-files.nix new file mode 100644 index 00000000..33807e49 --- /dev/null +++ b/tests/test-sources/modules/extra-files.nix @@ -0,0 +1,9 @@ +{ + query = { + extraFiles = { + "queries/lua/injections.scm" = '' + ;; extends + ''; + }; + }; +} diff --git a/wrappers/_shared.nix b/wrappers/_shared.nix index e6e0727f..9f5f99b9 100644 --- a/wrappers/_shared.nix +++ b/wrappers/_shared.nix @@ -26,12 +26,24 @@ in { configFiles = let cfg = config.programs.nixvim; in - lib.mapAttrs' ( - _: file: - lib.nameValuePair - "nvim/${file.path}" - {text = file.content;} + lib.mapAttrs' + ( + _: file: + lib.nameValuePair + "nvim/${file.path}" + {text = file.content;} + ) + cfg.files ) - cfg.files; + // ( + lib.mapAttrs' + ( + path: content: + lib.nameValuePair + "nvim/${path}" + {text = content;} + ) + cfg.extraFiles + ); } diff --git a/wrappers/modules/files.nix b/wrappers/modules/files.nix index 02fb98d4..7edc5509 100644 --- a/wrappers/modules/files.nix +++ b/wrappers/modules/files.nix @@ -57,8 +57,9 @@ in { # A directory with all the files in it filesPlugin = pkgs.buildEnv { name = "nixvim-config"; - paths = lib.mapAttrsToList (_: file: file.plugin) files; - ignoreCollisions = true; # Collisions can't happen by construction + paths = + (lib.mapAttrsToList (_: file: file.plugin) files) + ++ (lib.mapAttrsToList (path: content: pkgs.writeTextDir path content) config.extraFiles); }; }; }