From b6630684fb1b3d9feb0c19a82cd337b4b514ee8c Mon Sep 17 00:00:00 2001 From: LeMarsu Date: Sun, 9 Jun 2024 23:39:54 +0200 Subject: [PATCH] feat!: `init.lua` configuration is now a `mkNeovimPkg`'s option BREAKING CHANGE: The init configuration has moved out of runtime configuration. It is now in the mkNeovimPkg confuguration. --- README.md | 6 +++--- lib/mkNeovimPkg.nix | 5 +++-- lib/types.nix | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 41e714c..0f3ee96 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,7 @@ Here's a list of all accepted arguments |-------------------------|-------------------------|----------------------------------------------------------------| | `pkgs` | N/A | The nixpkgs set. **REQUIRED** | | `package` | `pkgs.neovim-unwrapped` | The unwrapped neovim package to use | +| `init` | `null` | The `init.lua` of your config (string or path)¹ | | `runtime` | `{}` | Your Runtime configuration (see below) | | `dependencies` | `[]` | A list of your dependencies (see below) | | `dependenciesExtraArgs` | `{}` | Extra arguments to load your dependencies in other files | @@ -193,16 +194,15 @@ Here's a list of all accepted arguments | `vimdiffAlias` | `false` | Wether to create a `vimdiff` alias to run neovim in diff mode | | `nvimdiffAlias` | `false` | Wether to create a `nvimdiff` alias to run neovim in diff mode | +> ¹ If you give your own `init.lua` as string or path, you'll have to call `sloth-flake` lua plugin yourself. See more below. + The Runtime configuration object accepts the following properties: | name | default | description | |-----------|---------|--------------------------------| | `version` | `null` | The version of your runtime | -| `init` | `null` | The `init.lua` of your config¹ | | `src` | `null` | The content of your runtime | -> ¹ If you give your own `init.lua`, you'll have to call `sloth-flake` lua plugin yourself. See more below. - The dependencies is a list of element of either: - path: the path of the file to load other dependencies - package: a nix package of a neovim/vim plugin diff --git a/lib/mkNeovimPkg.nix b/lib/mkNeovimPkg.nix index 9dd0ed7..fecac72 100644 --- a/lib/mkNeovimPkg.nix +++ b/lib/mkNeovimPkg.nix @@ -7,6 +7,7 @@ dependencies ? [], dependenciesExtraArgs ? {}, runtime ? null, + init ? null, viAlias ? false, vimAlias ? false, vimdiffAlias ? false, @@ -40,9 +41,9 @@ customRC = let rc = - if isNull runtime || isNull runtime.init + if isNull init then ../lua/default_init.lua - else runtime.init; + else init; in deps.textOrContent rc; diff --git a/lib/types.nix b/lib/types.nix index 2b61502..df0becb 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -11,9 +11,6 @@ in rec { # The version of the runtime version = option string; - # The init configuration file - init = option (either path string); - # The content of the runtime directory src = any; }; @@ -98,6 +95,9 @@ in rec { # Default is pkgs.neovim-unwrapped package = option drv; + # init.lua configuration + init = option (either string path); + # An array of dependencies. dependencies = option (list dependency);