From b54032f3f3268594094da79f28d688a3a2fe74a3 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 12 Mar 2024 03:48:38 +0300 Subject: [PATCH] modules/projects: switch to explicit lib calls --- modules/projects/default.nix | 2 +- modules/projects/project-nvim/config.nix | 7 ++++-- modules/projects/project-nvim/default.nix | 2 +- .../projects/project-nvim/project-nvim.nix | 25 ++++++++----------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/projects/default.nix b/modules/projects/default.nix index aa04d03..6b6c112 100644 --- a/modules/projects/default.nix +++ b/modules/projects/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./project-nvim ]; diff --git a/modules/projects/project-nvim/config.nix b/modules/projects/project-nvim/config.nix index 6fc78e4..5c036ef 100644 --- a/modules/projects/project-nvim/config.nix +++ b/modules/projects/project-nvim/config.nix @@ -3,7 +3,10 @@ lib, ... }: let - inherit (lib) mkIf nvim boolToString concatStringsSep; + inherit (lib.modules) mkIf; + inherit (lib.trivial) boolToString; + inherit (lib.strings) concatStringsSep; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.projects.project-nvim; in { @@ -12,7 +15,7 @@ in { "project-nvim" ]; - vim.luaConfigRC.project-nvim = nvim.dag.entryAnywhere '' + vim.luaConfigRC.project-nvim = entryAnywhere '' require('project_nvim').setup({ manual_mode = ${boolToString cfg.manualMode}, detection_methods = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.detectionMethods)} }, diff --git a/modules/projects/project-nvim/default.nix b/modules/projects/project-nvim/default.nix index db404ae..1e7b91a 100644 --- a/modules/projects/project-nvim/default.nix +++ b/modules/projects/project-nvim/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./project-nvim.nix diff --git a/modules/projects/project-nvim/project-nvim.nix b/modules/projects/project-nvim/project-nvim.nix index 5811f96..9331f37 100644 --- a/modules/projects/project-nvim/project-nvim.nix +++ b/modules/projects/project-nvim/project-nvim.nix @@ -1,60 +1,57 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkEnableOption mkOption types; +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) enum bool listOf str; in { options.vim.projects.project-nvim = { enable = mkEnableOption "project-nvim for project management"; manualMode = mkOption { - type = types.bool; + type = bool; default = true; description = "don't automatically change the root directory so the user has the option to manually do so using `:ProjectRoot` command"; }; # detection methods should accept one or more strings from a list detectionMethods = mkOption { - type = types.listOf types.str; + type = listOf str; default = ["lsp" "pattern"]; description = "Detection methods to use"; }; # patterns patterns = mkOption { - type = types.listOf types.str; + type = listOf str; default = [".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json" "flake.nix" "cargo.toml"]; description = "Patterns to use for pattern detection method"; }; # table of lsp servers to ignore by name lspIgnored = mkOption { - type = types.listOf types.str; + type = listOf str; default = []; description = "LSP servers no ignore by name"; }; excludeDirs = mkOption { - type = types.listOf types.str; + type = listOf str; default = []; description = "Directories to exclude from project root search"; }; showHidden = mkOption { - type = types.bool; + type = bool; default = false; description = "Show hidden files in telescope picker"; }; silentChdir = mkOption { - type = types.bool; + type = bool; default = true; description = "Silently change directory when changing project"; }; scopeChdir = mkOption { - type = types.enum ["global" "tab" "win"]; + type = enum ["global" "tab" "win"]; default = "global"; description = "What scope to change the directory"; };