diff --git a/README.md b/README.md index 731bc81c..e87891bb 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,8 @@ It takes a set with the following keys: - `pkgs`: The nixpkgs to use (defaults to the nixpkgs pointed at by the nixvim flake) - `module`: The nix module definition used to extend nixvim. This is useful to pass additional module machinery like `options` or `imports`. +- `extraSpecialArgs`: Extra arguments to pass to the modules when using functions. + Can be `self` in a flake for example. ## How does it work? When you build the module (probably using home-manager), it will install all diff --git a/templates/simple/config/default.nix b/templates/simple/config/default.nix index f9a64549..99607079 100644 --- a/templates/simple/config/default.nix +++ b/templates/simple/config/default.nix @@ -1,4 +1,4 @@ -{ +{self, ...}: { # Import all your configuration modules here imports = [ ./bufferline.nix diff --git a/templates/simple/flake.nix b/templates/simple/flake.nix index 508ae15b..ce06b266 100644 --- a/templates/simple/flake.nix +++ b/templates/simple/flake.nix @@ -7,6 +7,7 @@ }; outputs = { + self, nixpkgs, nixvim, flake-utils, @@ -21,6 +22,10 @@ nvim = nixvim'.makeNixvimWithModule { inherit pkgs; module = config; + # You can use `extraSpecialArgs` to pass additional arguments to your module files + extraSpecialArgs = { + inherit self; + }; }; in { checks = { diff --git a/wrappers/standalone.nix b/wrappers/standalone.nix index 1dcab6f0..858042cd 100644 --- a/wrappers/standalone.nix +++ b/wrappers/standalone.nix @@ -1,5 +1,6 @@ default_pkgs: modules: { pkgs ? default_pkgs, + extraSpecialArgs ? {}, module, }: let inherit (pkgs) lib; @@ -8,7 +9,9 @@ default_pkgs: modules: { shared = import ./_shared.nix modules { inherit pkgs lib; - config = {}; + config = { + _module.args = extraSpecialArgs; + }; }; eval = lib.evalModules {