From c8ea2f0f8e129ff2ebf0251a88050745a0400a7e Mon Sep 17 00:00:00 2001 From: n3oney Date: Mon, 22 May 2023 15:59:12 +0200 Subject: [PATCH] feat: make it possible to use strings for the RC when providing a string, it will get mapped as if it was given with nivm.dag.entryAnywhere, which will most likely be what people want --- docs/release-notes/rl-0.4.adoc | 2 ++ modules/core/default.nix | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/rl-0.4.adoc b/docs/release-notes/rl-0.4.adoc index f13350f..c3e7b80 100644 --- a/docs/release-notes/rl-0.4.adoc +++ b/docs/release-notes/rl-0.4.adoc @@ -16,6 +16,8 @@ https://github.com/n3oney[n3oney]: * Moved default keybinds into keybinds section of each module +* Simplified luaConfigRC and configRC setting - they can now just take strings + https://github.com/horriblename[horriblename]: * Added `clangd` as alternative lsp for C/++. diff --git a/modules/core/default.nix b/modules/core/default.nix index 91cccf5..244965b 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -132,13 +132,13 @@ in { configRC = mkOption { description = "vimrc contents"; - type = nvim.types.dagOf types.lines; + type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; default = {}; }; luaConfigRC = mkOption { description = "vim lua config"; - type = nvim.types.dagOf types.lines; + type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; default = {}; }; @@ -282,7 +282,12 @@ in { dag, mapResult, }: let - sortedDag = nvim.dag.topoSort dag; + finalDag = lib.mapAttrs (name: value: + if builtins.isString value + then nvim.dag.entryAnywhere value + else value) + dag; + sortedDag = nvim.dag.topoSort finalDag; result = if sortedDag ? result then mapResult sortedDag.result