From c062b976eff9f13597c7c23d77a6b3ac677b7fd5 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 29 Jun 2024 22:15:39 +0100 Subject: [PATCH] flake/legacyPackages: simplify `makeNixvim`, making it more powerful Rather than nesting it as `config`, pass `makeNixvim`'s argument through directly as a module. This not only simplifies the implementation, but allows users to use `makeNixvim` for any scenario where `makeNixvimWithModule` would normally be required. --- docs/user-guide/install.md | 5 +++-- flake-modules/legacy-packages.nix | 8 +------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/docs/user-guide/install.md b/docs/user-guide/install.md index 4a5342a0..c96b41a0 100644 --- a/docs/user-guide/install.md +++ b/docs/user-guide/install.md @@ -75,9 +75,10 @@ If using the home-manager module, see [Home Manager Usage](./modules/hm.md) for ### Standalone usage When using nixvim as a standalone derivation you can use the following functions, located in `.legacyPackages.${system}`: -- `makeNixvim`: This function takes an attribute set of options values as arguments +- `makeNixvim`: A simplified version of `makeNixvimWithModule` for when you only need to specify `module` and the other options can be left as the defaults. + This function's only argument is a nixvim module, e.g. `{ extraConfigLua = "print('hi')"; }` - `makeNixvimWithModule`: This function takes an attribute set of the form: `{pkgs, extraSpecialArgs, module}`. - The only required argument is `module`, being a NixOS module. This gives access to the `imports`, `options`, `config` variables, and using functions like `{config, ...}: { ... }`. + The only required argument is `module`, being a nixvim module. This gives access to the `imports`, `options`, `config` variables, and using functions like `{config, ...}: { ... }`. There are also some helper functions in `.lib.${system}` like: - `check.mkTestDerivationFromNixvimModule`, taking the same arguments as `makeNixvimWithModule` and generates a check derivation. diff --git a/flake-modules/legacy-packages.nix b/flake-modules/legacy-packages.nix index 749a2f13..88d7bea0 100644 --- a/flake-modules/legacy-packages.nix +++ b/flake-modules/legacy-packages.nix @@ -9,13 +9,7 @@ { legacyPackages = rec { inherit makeNixvimWithModule; - makeNixvim = - configuration: - makeNixvimWithModule { - module = { - config = configuration; - }; - }; + makeNixvim = module: makeNixvimWithModule { inherit module; }; }; }; }