mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
added formatter + reformat existing codebase (#175)
This commit is contained in:
parent
0bf4313f22
commit
264de8cefb
96 changed files with 3727 additions and 3341 deletions
|
@ -1,7 +1,9 @@
|
|||
(import (
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/c75e76f80c57784a6734356315b306140646ee84.tar.gz";
|
||||
sha256 = "071aal00zp2m9knnhddgr2wqzlx6i6qa1263lv1y7bdn2w20h10h"; }
|
||||
sha256 = "071aal00zp2m9knnhddgr2wqzlx6i6qa1263lv1y7bdn2w20h10h";
|
||||
}
|
||||
) {
|
||||
src = ./.;
|
||||
}).defaultNix
|
||||
})
|
||||
.defaultNix
|
||||
|
|
8
docs.nix
8
docs.nix
|
@ -1,5 +1,9 @@
|
|||
{ pkgs, lib, modules, ... }:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
modules,
|
||||
...
|
||||
}: let
|
||||
options = lib.evalModules {
|
||||
modules = modules;
|
||||
specialArgs = {inherit pkgs lib;};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
{pkgs, ...}: {
|
||||
programs.nixvim = {
|
||||
# This just enables NixVim.
|
||||
# If all you have is this, then there will be little visible difference
|
||||
|
|
46
flake.nix
46
flake.nix
|
@ -6,15 +6,21 @@
|
|||
inputs.beautysh.url = "github:lovesegfault/beautysh";
|
||||
inputs.beautysh.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
} @ inputs:
|
||||
with nixpkgs.lib;
|
||||
with builtins;
|
||||
let
|
||||
with builtins; let
|
||||
# TODO: Support nesting
|
||||
nixvimModules = map (f: ./modules + "/${f}") (attrNames (builtins.readDir ./modules));
|
||||
|
||||
modules = pkgs: nixvimModules ++ [
|
||||
(rec {
|
||||
modules = pkgs:
|
||||
nixvimModules
|
||||
++ [
|
||||
rec {
|
||||
_file = ./flake.nix;
|
||||
key = _file;
|
||||
config = {
|
||||
|
@ -25,17 +31,20 @@
|
|||
inputs = inputs;
|
||||
};
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
# ./plugins/default.nix
|
||||
];
|
||||
|
||||
flakeOutput =
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
(system: let
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
extractRustAnalyzer = { stdenv, pkgs }: stdenv.mkDerivation {
|
||||
extractRustAnalyzer = {
|
||||
stdenv,
|
||||
pkgs,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "extract_rust_analyzer";
|
||||
version = "master";
|
||||
|
||||
|
@ -51,14 +60,18 @@
|
|||
'';
|
||||
};
|
||||
extractRustAnalyzerPkg = pkgs.callPackage extractRustAnalyzer {};
|
||||
in
|
||||
{
|
||||
in {
|
||||
packages = {
|
||||
docs = pkgs.callPackage (import ./docs.nix) {
|
||||
modules = nixvimModules;
|
||||
};
|
||||
runUpdates = pkgs.callPackage
|
||||
({ pkgs, stdenv }: stdenv.mkDerivation {
|
||||
runUpdates =
|
||||
pkgs.callPackage
|
||||
({
|
||||
pkgs,
|
||||
stdenv,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "run-updates";
|
||||
version = pkgs.rust-analyzer.version;
|
||||
|
||||
|
@ -81,15 +94,18 @@
|
|||
};
|
||||
legacyPackages = rec {
|
||||
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules;
|
||||
makeNixvim = configuration: makeNixvimWithModule {
|
||||
makeNixvim = configuration:
|
||||
makeNixvimWithModule {
|
||||
module = {
|
||||
config = configuration;
|
||||
};
|
||||
};
|
||||
};
|
||||
formatter = pkgs.alejandra;
|
||||
});
|
||||
in
|
||||
flakeOutput // {
|
||||
flakeOutput
|
||||
// {
|
||||
nixosModules.nixvim = import ./wrappers/nixos.nix modules;
|
||||
homeManagerModules.nixvim = import ./wrappers/hm.nix modules;
|
||||
nixDarwinModules.nixvim = import ./wrappers/darwin.nix modules;
|
||||
|
|
145
lib/helpers.nix
145
lib/helpers.nix
|
@ -1,48 +1,52 @@
|
|||
{lib, ...}:
|
||||
with lib;
|
||||
rec {
|
||||
with lib; rec {
|
||||
# vim dictionaries are, in theory, compatible with JSON
|
||||
toVimDict = args: toJSON
|
||||
toVimDict = args:
|
||||
toJSON
|
||||
(lib.filterAttrs (n: v: !isNull v) args);
|
||||
|
||||
# Black functional magic that converts a bunch of different Nix types to their
|
||||
# lua equivalents!
|
||||
toLuaObject = args:
|
||||
if builtins.isAttrs args then
|
||||
if hasAttr "__raw" args then
|
||||
args.__raw
|
||||
if builtins.isAttrs args
|
||||
then
|
||||
if hasAttr "__raw" args
|
||||
then args.__raw
|
||||
else
|
||||
"{" + (concatStringsSep ","
|
||||
"{"
|
||||
+ (concatStringsSep ","
|
||||
(mapAttrsToList
|
||||
(n: v:
|
||||
if head (stringToCharacters n) == "@" then
|
||||
toLuaObject v
|
||||
if head (stringToCharacters n) == "@"
|
||||
then toLuaObject v
|
||||
else "[${toLuaObject n}] = " + (toLuaObject v))
|
||||
(filterAttrs (n: v: !isNull v && toLuaObject v != "{}") args))) + "}"
|
||||
else if builtins.isList args then
|
||||
"{" + concatMapStringsSep "," toLuaObject args + "}"
|
||||
else if builtins.isString args then
|
||||
(filterAttrs (n: v: !isNull v && toLuaObject v != "{}") args)))
|
||||
+ "}"
|
||||
else if builtins.isList args
|
||||
then "{" + concatMapStringsSep "," toLuaObject args + "}"
|
||||
else if builtins.isString args
|
||||
then
|
||||
# This should be enough!
|
||||
builtins.toJSON args
|
||||
else if builtins.isPath args then
|
||||
builtins.toJSON (toString args)
|
||||
else if builtins.isBool args then
|
||||
"${ boolToString args }"
|
||||
else if builtins.isFloat args then
|
||||
"${ toString args }"
|
||||
else if builtins.isInt args then
|
||||
"${ toString args }"
|
||||
else if isNull args then
|
||||
"nil"
|
||||
else if builtins.isPath args
|
||||
then builtins.toJSON (toString args)
|
||||
else if builtins.isBool args
|
||||
then "${boolToString args}"
|
||||
else if builtins.isFloat args
|
||||
then "${toString args}"
|
||||
else if builtins.isInt args
|
||||
then "${toString args}"
|
||||
else if isNull args
|
||||
then "nil"
|
||||
else "";
|
||||
|
||||
# Generates maps for a lua config
|
||||
genMaps = mode: maps:
|
||||
let
|
||||
normalized = builtins.mapAttrs
|
||||
genMaps = mode: maps: let
|
||||
normalized =
|
||||
builtins.mapAttrs
|
||||
(key: action:
|
||||
if builtins.isString action then
|
||||
{
|
||||
if builtins.isString action
|
||||
then {
|
||||
silent = false;
|
||||
expr = false;
|
||||
unique = false;
|
||||
|
@ -55,8 +59,7 @@ rec {
|
|||
maps;
|
||||
in
|
||||
builtins.attrValues (builtins.mapAttrs
|
||||
(key: action:
|
||||
{
|
||||
(key: action: {
|
||||
action = action.action;
|
||||
config = lib.filterAttrs (_: v: v) {
|
||||
inherit (action) silent expr unique noremap script nowait;
|
||||
|
@ -67,7 +70,8 @@ rec {
|
|||
normalized);
|
||||
|
||||
# Creates an option with a nullable type that defaults to null.
|
||||
mkNullOrOption = type: desc: lib.mkOption {
|
||||
mkNullOrOption = type: desc:
|
||||
lib.mkOption {
|
||||
type = lib.types.nullOr type;
|
||||
default = null;
|
||||
description = desc;
|
||||
|
@ -76,11 +80,14 @@ rec {
|
|||
mkIfNonNull = c: mkIf (!isNull c) c;
|
||||
|
||||
defaultNullOpts = rec {
|
||||
mkNullable = type: default: desc: mkNullOrOption type (
|
||||
mkNullable = type: default: desc:
|
||||
mkNullOrOption type (
|
||||
let
|
||||
defaultDesc = "default: `${default}`";
|
||||
in
|
||||
if desc == "" then defaultDesc else ''
|
||||
if desc == ""
|
||||
then defaultDesc
|
||||
else ''
|
||||
${desc}
|
||||
|
||||
${defaultDesc}
|
||||
|
@ -88,45 +95,64 @@ rec {
|
|||
);
|
||||
|
||||
mkInt = default: mkNullable lib.types.int (toString default);
|
||||
mkBool = default: mkNullable lib.types.bool (if default then "true" else "false");
|
||||
mkBool = default:
|
||||
mkNullable lib.types.bool (
|
||||
if default
|
||||
then "true"
|
||||
else "false"
|
||||
);
|
||||
mkStr = default: mkNullable lib.types.str ''${builtins.toString default}'';
|
||||
mkEnum = enum: default: mkNullable (lib.types.enum enum) ''"${default}"'';
|
||||
mkEnumFirstDefault = enum: mkEnum enum (head enum);
|
||||
};
|
||||
|
||||
mkPackageOption = name: default: mkOption {
|
||||
mkPackageOption = name: default:
|
||||
mkOption {
|
||||
type = types.package;
|
||||
inherit default;
|
||||
description = "Plugin to use for ${name}";
|
||||
};
|
||||
|
||||
mkPlugin = { config, lib, ... }: { name
|
||||
, description
|
||||
, package ? null
|
||||
, extraPlugins ? [ ]
|
||||
, extraPackages ? [ ]
|
||||
, options ? { }
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
mkPlugin = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
name,
|
||||
description,
|
||||
package ? null,
|
||||
extraPlugins ? [],
|
||||
extraPackages ? [],
|
||||
options ? {},
|
||||
...
|
||||
}: let
|
||||
cfg = config.plugins.${name};
|
||||
# TODO support nested options!
|
||||
pluginOptions = mapAttrs (k: v: v.option) options;
|
||||
globals = mapAttrs'
|
||||
globals =
|
||||
mapAttrs'
|
||||
(name: opt: {
|
||||
name = opt.global;
|
||||
value = if cfg.${name} != null then opt.value cfg.${name} else null;
|
||||
value =
|
||||
if cfg.${name} != null
|
||||
then opt.value cfg.${name}
|
||||
else null;
|
||||
})
|
||||
options;
|
||||
# does this evaluate package?
|
||||
packageOption = if package == null then { } else {
|
||||
packageOption =
|
||||
if package == null
|
||||
then {}
|
||||
else {
|
||||
package = mkPackageOption name package;
|
||||
};
|
||||
in
|
||||
in {
|
||||
options.plugins.${name} =
|
||||
{
|
||||
options.plugins.${name} = {
|
||||
enable = mkEnableOption description;
|
||||
} // packageOption // pluginOptions;
|
||||
}
|
||||
// packageOption
|
||||
// pluginOptions;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
inherit extraPackages globals;
|
||||
|
@ -136,11 +162,24 @@ rec {
|
|||
};
|
||||
|
||||
globalVal = val:
|
||||
if builtins.isBool val then
|
||||
(if val == false then 0 else 1)
|
||||
if builtins.isBool val
|
||||
then
|
||||
(
|
||||
if val == false
|
||||
then 0
|
||||
else 1
|
||||
)
|
||||
else val;
|
||||
|
||||
mkDefaultOpt = { type, global, description ? null, example ? null, default ? null, value ? v: (globalVal v), ... }: {
|
||||
mkDefaultOpt = {
|
||||
type,
|
||||
global,
|
||||
description ? null,
|
||||
example ? null,
|
||||
default ? null,
|
||||
value ? v: (globalVal v),
|
||||
...
|
||||
}: {
|
||||
option = mkOption {
|
||||
type = types.nullOr type;
|
||||
default = default;
|
||||
|
|
|
@ -1,48 +1,47 @@
|
|||
{lib, ...}:
|
||||
with lib;
|
||||
|
||||
rec {
|
||||
with lib; rec {
|
||||
# This should be used instead of mkRemovedOptionModule, when the option still works,
|
||||
# but is just deprecated and should be changed now and for the future
|
||||
mkDeprecatedOption =
|
||||
{ option # an array of the path to the option
|
||||
, alternative ? null
|
||||
, message ? null
|
||||
, visible ? false
|
||||
}:
|
||||
{ options, config, ... }:
|
||||
let
|
||||
mkDeprecatedOption = {
|
||||
option, # an array of the path to the option
|
||||
alternative ? null,
|
||||
message ? null,
|
||||
visible ? false,
|
||||
}: {
|
||||
options,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
fromOpt = getAttrFromPath option options;
|
||||
fromValue = getAttrFromPath option config;
|
||||
fullMessage = "The option `${showOption option}` has been deprecated, but might still work." +
|
||||
(optionalString (alternative != null) " You may want to use `${showOption alternative}` instead.") +
|
||||
(optionalString (message != null) " Message: ${message}");
|
||||
in
|
||||
{
|
||||
fullMessage =
|
||||
"The option `${showOption option}` has been deprecated, but might still work."
|
||||
+ (optionalString (alternative != null) " You may want to use `${showOption alternative}` instead.")
|
||||
+ (optionalString (message != null) " Message: ${message}");
|
||||
in {
|
||||
config = mkIf (fromOpt.isDefined && fromValue != fromOpt.default) {
|
||||
warnings = [
|
||||
("Nixvim: ${fullMessage}")
|
||||
"Nixvim: ${fullMessage}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
mkRenamedOption =
|
||||
{ option
|
||||
, newOption
|
||||
, visible ? false
|
||||
, warn ? true
|
||||
, overrideDescription ? null
|
||||
}:
|
||||
{ options, ... }:
|
||||
let
|
||||
mkRenamedOption = {
|
||||
option,
|
||||
newOption,
|
||||
visible ? false,
|
||||
warn ? true,
|
||||
overrideDescription ? null,
|
||||
}: {options, ...}: let
|
||||
fromOpt = getAttrFromPath option options;
|
||||
# toOf = attrByPath newOption
|
||||
# (abort "Renaming error: option `${showOption newOption}` does not exist.");
|
||||
toType = let opt = attrByPath newOption { } options; in
|
||||
toType = let
|
||||
opt = attrByPath newOption {} options;
|
||||
in
|
||||
opt.type or (types.submodule {});
|
||||
message = "`${showOption option}` has been renamed to `${showOption newOption}`, but can still be used for compatibility";
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = setAttrByPath option (mkOption
|
||||
{
|
||||
inherit visible;
|
||||
|
@ -50,7 +49,8 @@ rec {
|
|||
if overrideDescription == null
|
||||
then message
|
||||
else overrideDescription;
|
||||
} // optionalAttrs (toType != null) {
|
||||
}
|
||||
// optionalAttrs (toType != null) {
|
||||
type = toType;
|
||||
});
|
||||
config = mkMerge [
|
||||
|
@ -61,7 +61,8 @@ rec {
|
|||
];
|
||||
};
|
||||
|
||||
mkAliasOption = option: newOption: mkRenamedOption {
|
||||
mkAliasOption = option: newOption:
|
||||
mkRenamedOption {
|
||||
inherit option newOption;
|
||||
visible = true;
|
||||
warn = false;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
|
||||
autoGroupOption = types.submodule {
|
||||
|
@ -47,9 +50,7 @@ let
|
|||
nested = helpers.defaultNullOpts.mkBool false "Run nested autocommands.";
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
autoGroups = mkOption {
|
||||
type = types.attrsOf autoGroupOption;
|
||||
|
@ -81,7 +82,8 @@ in
|
|||
};
|
||||
|
||||
config = mkIf (config.autoGroups != {} || config.autoCmd != {}) {
|
||||
extraConfigLuaPost = (optionalString (config.autoGroups != { }) ''
|
||||
extraConfigLuaPost =
|
||||
(optionalString (config.autoGroups != {}) ''
|
||||
-- Set up autogroups {{
|
||||
do
|
||||
local __nixvim_autogroups = ${helpers.toLuaObject config.autoGroups}
|
||||
|
@ -91,8 +93,8 @@ in
|
|||
end
|
||||
end
|
||||
-- }}
|
||||
'') +
|
||||
(optionalString (config.autoCmd != [ ]) ''
|
||||
'')
|
||||
+ (optionalString (config.autoCmd != []) ''
|
||||
-- Set up autocommands {{
|
||||
do
|
||||
local __nixvim_autocommands = ${helpers.toLuaObject config.autoCmd}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
options = {
|
||||
colorscheme = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
with lib; {
|
||||
options = {
|
||||
highlight = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
|
@ -29,7 +31,8 @@ with lib;
|
|||
};
|
||||
|
||||
config = mkIf (config.highlight != {} || config.match != {}) {
|
||||
extraConfigLuaPost = (optionalString (config.highlight != { }) ''
|
||||
extraConfigLuaPost =
|
||||
(optionalString (config.highlight != {}) ''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
local highlights = ${helpers.toLuaObject config.highlight}
|
||||
|
@ -39,8 +42,8 @@ with lib;
|
|||
end
|
||||
end
|
||||
-- }}
|
||||
'') +
|
||||
(optionalString (config.match != { }) ''
|
||||
'')
|
||||
+ (optionalString (config.match != {}) ''
|
||||
-- Match groups {{
|
||||
do
|
||||
local match = ${helpers.toLuaObject config.match}
|
||||
|
@ -53,4 +56,3 @@ with lib;
|
|||
'');
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
|
||||
mapOption = types.oneOf [
|
||||
|
@ -57,13 +60,13 @@ let
|
|||
})
|
||||
];
|
||||
|
||||
mapOptions = mode: mkOption {
|
||||
mapOptions = mode:
|
||||
mkOption {
|
||||
description = "Mappings for ${mode} mode";
|
||||
type = types.attrsOf mapOption;
|
||||
default = {};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
maps = mkOption {
|
||||
type = types.submodule {
|
||||
|
@ -101,22 +104,20 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
mappings =
|
||||
(helpers.genMaps "" config.maps.normalVisualOp) ++
|
||||
(helpers.genMaps "n" config.maps.normal) ++
|
||||
(helpers.genMaps "i" config.maps.insert) ++
|
||||
(helpers.genMaps "v" config.maps.visual) ++
|
||||
(helpers.genMaps "x" config.maps.visualOnly) ++
|
||||
(helpers.genMaps "s" config.maps.select) ++
|
||||
(helpers.genMaps "t" config.maps.terminal) ++
|
||||
(helpers.genMaps "o" config.maps.operator) ++
|
||||
(helpers.genMaps "l" config.maps.lang) ++
|
||||
(helpers.genMaps "!" config.maps.insertCommand) ++
|
||||
(helpers.genMaps "c" config.maps.command);
|
||||
in
|
||||
{
|
||||
(helpers.genMaps "" config.maps.normalVisualOp)
|
||||
++ (helpers.genMaps "n" config.maps.normal)
|
||||
++ (helpers.genMaps "i" config.maps.insert)
|
||||
++ (helpers.genMaps "v" config.maps.visual)
|
||||
++ (helpers.genMaps "x" config.maps.visualOnly)
|
||||
++ (helpers.genMaps "s" config.maps.select)
|
||||
++ (helpers.genMaps "t" config.maps.terminal)
|
||||
++ (helpers.genMaps "o" config.maps.operator)
|
||||
++ (helpers.genMaps "l" config.maps.lang)
|
||||
++ (helpers.genMaps "!" config.maps.insertCommand)
|
||||
++ (helpers.genMaps "c" config.maps.command);
|
||||
in {
|
||||
extraConfigLua = optionalString (mappings != []) ''
|
||||
-- Set up keybinds {{{
|
||||
do
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ../lib/helpers.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
in {
|
||||
options = {
|
||||
options = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
|
@ -19,7 +21,8 @@ in
|
|||
};
|
||||
|
||||
config = {
|
||||
extraConfigLuaPre = optionalString (config.globals != { }) ''
|
||||
extraConfigLuaPre =
|
||||
optionalString (config.globals != {}) ''
|
||||
-- Set up globals {{{
|
||||
do
|
||||
local nixvim_globals = ${helpers.toLuaObject config.globals}
|
||||
|
@ -29,7 +32,8 @@ in
|
|||
end
|
||||
end
|
||||
-- }}}
|
||||
'' + optionalString (config.options != { }) ''
|
||||
''
|
||||
+ optionalString (config.options != {}) ''
|
||||
-- Set up options {{{
|
||||
do
|
||||
local nixvim_options = ${helpers.toLuaObject config.options}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
pluginWithConfigType = types.submodule {
|
||||
options = {
|
||||
config = mkOption {
|
||||
|
@ -9,7 +13,9 @@ let
|
|||
default = "";
|
||||
};
|
||||
|
||||
optional = mkEnableOption "optional" // {
|
||||
optional =
|
||||
mkEnableOption "optional"
|
||||
// {
|
||||
description = "Don't load by default (load with :packadd)";
|
||||
};
|
||||
|
||||
|
@ -19,8 +25,7 @@ let
|
|||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
viAlias = mkOption {
|
||||
type = types.bool;
|
||||
|
@ -74,7 +79,6 @@ in
|
|||
description = "Extra contents for init.lua after everything else";
|
||||
};
|
||||
|
||||
|
||||
extraConfigVim = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
|
@ -101,16 +105,21 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
|
||||
config = let
|
||||
defaultPlugin = {
|
||||
plugin = null;
|
||||
config = "";
|
||||
optional = false;
|
||||
};
|
||||
|
||||
normalizedPlugins = map (x: defaultPlugin // (if x ? plugin then x else { plugin = x; })) config.extraPlugins;
|
||||
normalizedPlugins = map (x:
|
||||
defaultPlugin
|
||||
// (
|
||||
if x ? plugin
|
||||
then x
|
||||
else {plugin = x;}
|
||||
))
|
||||
config.extraPlugins;
|
||||
|
||||
neovimConfig = pkgs.neovimUtils.makeNeovimConfig ({
|
||||
inherit (config) viAlias vimAlias;
|
||||
|
@ -121,8 +130,12 @@ in
|
|||
# or more generally before the commit:
|
||||
# cda1f8ae468 - neovim: pass packpath via the wrapper
|
||||
// optionalAttrs (functionArgs pkgs.neovimUtils.makeNeovimConfig ? configure) {
|
||||
configure.packages =
|
||||
{ nixvim = { start = map (x: x.plugin) normalizedPlugins; opt = [ ]; }; };
|
||||
configure.packages = {
|
||||
nixvim = {
|
||||
start = map (x: x.plugin) normalizedPlugins;
|
||||
opt = [];
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
customRC =
|
||||
|
@ -130,16 +143,16 @@ in
|
|||
vim.cmd([[
|
||||
${neovimConfig.neovimRcContent}
|
||||
]])
|
||||
'' +
|
||||
(optionalString (config.extraConfigLuaPre != "") ''
|
||||
''
|
||||
+ (optionalString (config.extraConfigLuaPre != "") ''
|
||||
${config.extraConfigLuaPre}
|
||||
'') +
|
||||
(optionalString (config.extraConfigVim != "") ''
|
||||
'')
|
||||
+ (optionalString (config.extraConfigVim != "") ''
|
||||
vim.cmd([[
|
||||
${config.extraConfigVim}
|
||||
]])
|
||||
'') +
|
||||
(optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
||||
'')
|
||||
+ (optionalString (config.extraConfigLua != "" || config.extraConfigLuaPost != "") ''
|
||||
${config.extraConfigLua}
|
||||
${config.extraConfigLuaPost}
|
||||
'');
|
||||
|
@ -147,17 +160,16 @@ in
|
|||
extraWrapperArgs = builtins.concatStringsSep " " (
|
||||
(optional (config.extraPackages != [])
|
||||
''--prefix PATH : "${makeBinPath config.extraPackages}"'')
|
||||
++
|
||||
(optional (config.wrapRc)
|
||||
++ (optional (config.wrapRc)
|
||||
''--add-flags -u --add-flags "${pkgs.writeText "init.lua" customRC}"'')
|
||||
);
|
||||
|
||||
wrappedNeovim = pkgs.wrapNeovimUnstable config.package (neovimConfig // {
|
||||
wrappedNeovim = pkgs.wrapNeovimUnstable config.package (neovimConfig
|
||||
// {
|
||||
wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs + " " + extraWrapperArgs;
|
||||
wrapRc = false;
|
||||
});
|
||||
in
|
||||
{
|
||||
in {
|
||||
finalPackage = wrappedNeovim;
|
||||
initContent = customRC;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{ ... }:
|
||||
{
|
||||
{...}: {
|
||||
imports = [
|
||||
../plugins/default.nix
|
||||
];
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{lib, ...}:
|
||||
with lib;
|
||||
|
||||
{
|
||||
with lib; {
|
||||
options = {
|
||||
warnings = mkOption {
|
||||
type = types.listOf types.str;
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.barbar;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.barbar = {
|
||||
enable = mkEnableOption "barbar.nvim";
|
||||
|
||||
|
@ -65,9 +68,9 @@ in
|
|||
|
||||
highlightVisible = helpers.defaultNullOpts.mkBool true "Highlight visible buffers";
|
||||
|
||||
|
||||
icons = {
|
||||
enable = helpers.defaultNullOpts.mkNullable
|
||||
enable =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; (either bool (enum ["numbers" "both"])))
|
||||
"true"
|
||||
''
|
||||
|
@ -75,7 +78,8 @@ in
|
|||
'both', will show buffer index and icons in the tabline
|
||||
'';
|
||||
|
||||
customColors = helpers.defaultNullOpts.mkNullable
|
||||
customColors =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(types.either types.bool types.str)
|
||||
"false"
|
||||
''
|
||||
|
@ -122,7 +126,6 @@ in
|
|||
But only a static string is accepted here.
|
||||
'';
|
||||
|
||||
|
||||
# Keybinds concept:
|
||||
# keys = {
|
||||
# previousBuffer = mkBindDef "normal" "Previous buffer" { action = ":BufferPrevious<CR>"; silent = true; } "<A-,>";
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ config, pkgs, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
cfg = config.plugins.bufferline;
|
||||
optionWarnings = import ../../lib/option-warnings.nix args;
|
||||
helpers = import ../helpers.nix args;
|
||||
|
@ -22,8 +26,7 @@ let
|
|||
}));
|
||||
default = {};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = [
|
||||
(optionWarnings.mkDeprecatedOption {
|
||||
option = ["plugins" "bufferline" "indicatorIcon"];
|
||||
|
@ -252,10 +255,10 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
setupOptions = {
|
||||
options = {
|
||||
options =
|
||||
{
|
||||
numbers = cfg.numbers;
|
||||
close_command = cfg.closeCommand;
|
||||
right_mouse_command = cfg.rightMouseCommand;
|
||||
|
@ -264,10 +267,13 @@ in
|
|||
# deprecated, but might still work
|
||||
indicator_icon = cfg.indicatorIcon;
|
||||
indicator =
|
||||
if cfg.indicator != null then with cfg.indicator; {
|
||||
if cfg.indicator != null
|
||||
then
|
||||
with cfg.indicator; {
|
||||
icon = icon;
|
||||
style = style;
|
||||
} else null;
|
||||
}
|
||||
else null;
|
||||
buffer_close_icon = cfg.bufferCloseIcon;
|
||||
modified_icon = cfg.modifiedIcon;
|
||||
close_icon = cfg.closeIcon;
|
||||
|
@ -290,8 +296,13 @@ in
|
|||
enforce_regular_tabs = cfg.enforceRegularTabs;
|
||||
always_show_bufferline = cfg.alwaysShowBufferline;
|
||||
sort_by = cfg.sortBy;
|
||||
} // cfg.extraOptions;
|
||||
highlights = if builtins.isNull cfg.highlights then null else with cfg.highlights; {
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
highlights =
|
||||
if builtins.isNull cfg.highlights
|
||||
then null
|
||||
else
|
||||
with cfg.highlights; {
|
||||
fill = fill;
|
||||
background = background;
|
||||
|
||||
|
@ -350,7 +361,6 @@ in
|
|||
pick = pick;
|
||||
pick_visible = pickVisible;
|
||||
pick_selected = pickSelected;
|
||||
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.colorschemes.base16;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
themes = import ./base16-list.nix;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
colorschemes.base16 = {
|
||||
enable = mkEnableOption "base16";
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.colorschemes.gruvbox;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
colors = types.enum ["bg" "red" "green" "yellow" "blue" "purple" "aqua" "gray" "fg" "bg0_h" "bg0" "bg1" "bg2" "bg3" "bg4" "gray" "orange" "bg0_s" "fg0" "fg1" "fg2" "fg3" "fg4"];
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
colorschemes.gruvbox = {
|
||||
enable = mkEnableOption "gruvbox";
|
||||
|
@ -110,7 +113,6 @@ in
|
|||
transparentBg = mkEnableOption "transparent background";
|
||||
|
||||
trueColor = mkEnableOption "true color support";
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,29 +1,37 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.colorschemes.nord;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
colorschemes.nord = {
|
||||
enable = mkEnableOption "nord";
|
||||
|
||||
package = helpers.mkPackageOption "nord.vim" pkgs.vimPlugins.nord-nvim;
|
||||
|
||||
contrast = mkEnableOption
|
||||
contrast =
|
||||
mkEnableOption
|
||||
"Make sidebars and popup menus like nvim-tree and telescope have a different background";
|
||||
|
||||
borders = mkEnableOption
|
||||
borders =
|
||||
mkEnableOption
|
||||
"Enable the border between verticaly split windows visable";
|
||||
|
||||
disable_background = mkEnableOption
|
||||
disable_background =
|
||||
mkEnableOption
|
||||
"Disable the setting of background color so that NeoVim can use your terminal background";
|
||||
|
||||
cursorline_transparent = mkEnableOption
|
||||
cursorline_transparent =
|
||||
mkEnableOption
|
||||
"Set the cursorline transparent/visible";
|
||||
|
||||
enable_sidebar_background = mkEnableOption
|
||||
enable_sidebar_background =
|
||||
mkEnableOption
|
||||
"Re-enables the background of the sidebar if you disabled the background of everything";
|
||||
|
||||
italic = mkOption {
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.colorschemes.one;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
colorschemes.one = {
|
||||
enable = mkEnableOption "vim-one";
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.colorschemes.onedark;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
colorschemes.onedark = {
|
||||
enable = mkEnableOption "onedark";
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
cfg = config.colorschemes.tokyonight;
|
||||
helpers = import ../helpers.nix args;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
colorschemes.tokyonight = {
|
||||
enable = mkEnableOption "tokyonight";
|
||||
|
@ -17,13 +17,11 @@ in
|
|||
helpers.defaultNullOpts.mkBool true
|
||||
"Configure the colors used when opening a :terminal in Neovim";
|
||||
transparent = helpers.defaultNullOpts.mkBool false "disable setting the background color";
|
||||
styles =
|
||||
let
|
||||
styles = let
|
||||
mkBackgroundStyle = name:
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault ["dark" "transparent" "normal"]
|
||||
"Background style for ${name}";
|
||||
in
|
||||
{
|
||||
in {
|
||||
comments =
|
||||
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
||||
"Define comments highlight properties";
|
||||
|
@ -58,8 +56,7 @@ in
|
|||
colorscheme = "tokyonight";
|
||||
extraPlugins = [cfg.package];
|
||||
options = {termguicolors = true;};
|
||||
extraConfigLuaPre =
|
||||
let
|
||||
extraConfigLuaPre = let
|
||||
setupOptions = with cfg; {
|
||||
inherit (cfg) style transparent styles sidebars;
|
||||
terminal_colors = terminalColors;
|
||||
|
@ -68,8 +65,7 @@ in
|
|||
lualine_bold = lualineBold;
|
||||
day_brightness = dayBrightness;
|
||||
};
|
||||
in
|
||||
''
|
||||
in ''
|
||||
require("tokyonight").setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.copilot;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.copilot = {
|
||||
enable = mkEnableOption "copilot";
|
||||
|
@ -27,12 +30,17 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
mkIf cfg.enable {
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
globals = {
|
||||
globals =
|
||||
{
|
||||
copilot_node_command = "${pkgs.nodejs-16_x}/bin/node";
|
||||
copilot_filetypes = cfg.filetypes;
|
||||
} // (if cfg.proxy != null then { copilot_proxy = cfg.proxy; } else { });
|
||||
}
|
||||
// (
|
||||
if cfg.proxy != null
|
||||
then {copilot_proxy = cfg.proxy;}
|
||||
else {}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.coq-nvim;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
plugins = import ../plugin-defs.nix {inherit pkgs;};
|
||||
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.coq-nvim = {
|
||||
enable = mkEnableOption "coq-nvim";
|
||||
|
@ -28,17 +30,18 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
settings = {
|
||||
auto_start = cfg.autoStart;
|
||||
"keymap.recommended" = cfg.recommendedKeymaps;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [
|
||||
extraPlugins =
|
||||
[
|
||||
cfg.package
|
||||
] ++ optional cfg.installArtifacts plugins.coq-artifacts;
|
||||
]
|
||||
++ optional cfg.installArtifacts plugins.coq-artifacts;
|
||||
plugins.lsp = {
|
||||
preConfig = ''
|
||||
vim.g.coq_settings = ${helpers.toLuaObject settings}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lspkind;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.lspkind = {
|
||||
enable = mkEnableOption "lspkind.nvim";
|
||||
|
||||
|
@ -61,18 +64,23 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
doCmp = cfg.cmp.enable && config.plugins.nvim-cmp.enable;
|
||||
options = {
|
||||
options =
|
||||
{
|
||||
mode = cfg.mode;
|
||||
preset = cfg.preset;
|
||||
symbol_map = cfg.symbolMap;
|
||||
} // (if doCmp then {
|
||||
}
|
||||
// (
|
||||
if doCmp
|
||||
then {
|
||||
maxwidth = cfg.cmp.maxWidth;
|
||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||
menu = cfg.cmp.menu;
|
||||
} else { });
|
||||
}
|
||||
else {}
|
||||
);
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
|
@ -82,13 +90,15 @@ in
|
|||
'';
|
||||
|
||||
plugins.nvim-cmp.formatting.format =
|
||||
if cfg.cmp.after != null then ''
|
||||
if cfg.cmp.after != null
|
||||
then ''
|
||||
function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
||||
|
||||
return (${cfg.cmp.after})(entry, vim_after, kind)
|
||||
end
|
||||
'' else ''
|
||||
''
|
||||
else ''
|
||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
helpers = import ../../helpers.nix { inherit lib; };
|
||||
in with helpers; with lib;
|
||||
{
|
||||
mkCmpSourcePlugin = { name, extraPlugins ? [], useDefaultPackage ? true, ... }: mkPlugin attrs {
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../../helpers.nix {inherit lib;};
|
||||
in
|
||||
with helpers;
|
||||
with lib; {
|
||||
mkCmpSourcePlugin = {
|
||||
name,
|
||||
extraPlugins ? [],
|
||||
useDefaultPackage ? true,
|
||||
...
|
||||
}:
|
||||
mkPlugin attrs {
|
||||
inherit name;
|
||||
extraPlugins = extraPlugins ++ (lists.optional useDefaultPackage pkgs.vimPlugins.${name});
|
||||
description = "Enable ${name}";
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
cfg = config.plugins.nvim-cmp;
|
||||
helpers = import ../../helpers.nix {inherit lib;};
|
||||
mkNullOrOption = helpers.mkNullOrOption;
|
||||
cmpLib = import ./cmp-helpers.nix args;
|
||||
# functionName should be a string
|
||||
# parameters should be a list of strings
|
||||
wrapWithFunction = functionName: parameters:
|
||||
let
|
||||
wrapWithFunction = functionName: parameters: let
|
||||
parameterString = strings.concatStringsSep "," parameters;
|
||||
in
|
||||
''${functionName}(${parameterString})'';
|
||||
in
|
||||
{
|
||||
in ''${functionName}(${parameterString})'';
|
||||
in {
|
||||
options.plugins.nvim-cmp = {
|
||||
enable = mkEnableOption "nvim-cmp";
|
||||
|
||||
|
@ -218,8 +219,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
sources =
|
||||
let
|
||||
sources = let
|
||||
source_config = types.submodule ({...}: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
|
@ -296,8 +296,7 @@ in
|
|||
}));
|
||||
};
|
||||
|
||||
window =
|
||||
let
|
||||
window = let
|
||||
# Reusable options
|
||||
border = with types; mkNullOrOption (either str (listOf str)) null;
|
||||
winhighlight = mkNullOrOption types.str null;
|
||||
|
@ -336,58 +335,89 @@ in
|
|||
experimental = mkNullOrOption types.attrs "Experimental features";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
enabled = cfg.enable;
|
||||
performance = cfg.performance;
|
||||
preselect = if (isNull cfg.preselect) then null else helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}";
|
||||
preselect =
|
||||
if (isNull cfg.preselect)
|
||||
then null
|
||||
else helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}";
|
||||
|
||||
# Not very readable sorry
|
||||
# If null then null
|
||||
# If an attribute is a string, just treat it as lua code for that mapping
|
||||
# If an attribute is a module, create a mapping with cmp.mapping() using the action as the first input and the modes as the second.
|
||||
mapping =
|
||||
let
|
||||
mapping = let
|
||||
mappings =
|
||||
if (isNull cfg.mapping) then null
|
||||
if (isNull cfg.mapping)
|
||||
then null
|
||||
else
|
||||
mapAttrs
|
||||
(bind: mapping: helpers.mkRaw (if isString mapping then mapping
|
||||
else "cmp.mapping(${mapping.action}${optionalString (mapping.modes != null && length mapping.modes >= 1) ("," + (helpers.toLuaObject mapping.modes))})"))
|
||||
(bind: mapping:
|
||||
helpers.mkRaw (
|
||||
if isString mapping
|
||||
then mapping
|
||||
else "cmp.mapping(${mapping.action}${optionalString (mapping.modes != null && length mapping.modes >= 1) ("," + (helpers.toLuaObject mapping.modes))})"
|
||||
))
|
||||
cfg.mapping;
|
||||
luaMappings = (helpers.toLuaObject mappings);
|
||||
luaMappings = helpers.toLuaObject mappings;
|
||||
wrapped = lists.fold (presetName: prevString: ''cmp.mapping.preset.${presetName}(${prevString})'') luaMappings cfg.mappingPresets;
|
||||
in
|
||||
helpers.mkRaw wrapped;
|
||||
|
||||
snippet = {
|
||||
expand = if (isNull cfg.snippet || isNull cfg.snippet.expand) then null else helpers.mkRaw cfg.snippet.expand;
|
||||
expand =
|
||||
if (isNull cfg.snippet || isNull cfg.snippet.expand)
|
||||
then null
|
||||
else helpers.mkRaw cfg.snippet.expand;
|
||||
};
|
||||
|
||||
completion = if (isNull cfg.completion) then null else {
|
||||
completion =
|
||||
if (isNull cfg.completion)
|
||||
then null
|
||||
else {
|
||||
keyword_length = cfg.completion.keyword_length;
|
||||
keyword_pattern = cfg.completion.keyword_pattern;
|
||||
autocomplete = if (isNull cfg.completion.autocomplete) then null else mkRaw cfg.completion.autocomplete;
|
||||
autocomplete =
|
||||
if (isNull cfg.completion.autocomplete)
|
||||
then null
|
||||
else mkRaw cfg.completion.autocomplete;
|
||||
completeopt = cfg.completion.completeopt;
|
||||
};
|
||||
|
||||
confirmation = if (isNull cfg.confirmation) then null else {
|
||||
confirmation =
|
||||
if (isNull cfg.confirmation)
|
||||
then null
|
||||
else {
|
||||
get_commit_characters =
|
||||
if (isString cfg.confirmation.get_commit_characters) then helpers.mkRaw cfg.confirmation.get_commit_characters
|
||||
if (isString cfg.confirmation.get_commit_characters)
|
||||
then helpers.mkRaw cfg.confirmation.get_commit_characters
|
||||
else cfg.confirmation.get_commit_characters;
|
||||
};
|
||||
|
||||
formatting = if (isNull cfg.formatting) then null else {
|
||||
formatting =
|
||||
if (isNull cfg.formatting)
|
||||
then null
|
||||
else {
|
||||
fields = cfg.formatting.fields;
|
||||
format = if (isNull cfg.formatting.format) then null else helpers.mkRaw cfg.formatting.format;
|
||||
format =
|
||||
if (isNull cfg.formatting.format)
|
||||
then null
|
||||
else helpers.mkRaw cfg.formatting.format;
|
||||
};
|
||||
|
||||
matching = cfg.matching;
|
||||
|
||||
sorting = if (isNull cfg.sorting) then null else {
|
||||
sorting =
|
||||
if (isNull cfg.sorting)
|
||||
then null
|
||||
else {
|
||||
priority_weight = cfg.sorting.priority_weight;
|
||||
comparators = if (isNull cfg.sorting.comparators) then null else helpers.mkRaw cfg.sorting.comparators;
|
||||
comparators =
|
||||
if (isNull cfg.sorting.comparators)
|
||||
then null
|
||||
else helpers.mkRaw cfg.sorting.comparators;
|
||||
};
|
||||
|
||||
sources = cfg.sources;
|
||||
|
@ -406,9 +436,11 @@ in
|
|||
|
||||
# If auto_enable_sources is set to true, figure out which are provided by the user
|
||||
# and enable the corresponding plugins.
|
||||
plugins =
|
||||
let
|
||||
flattened_sources = if (isNull cfg.sources) then [ ] else flatten cfg.sources;
|
||||
plugins = let
|
||||
flattened_sources =
|
||||
if (isNull cfg.sources)
|
||||
then []
|
||||
else flatten cfg.sources;
|
||||
# Take only the names from the sources provided by the user
|
||||
found_sources = lists.unique (lists.map (source: source.name) flattened_sources);
|
||||
# A list of known source names
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs:
|
||||
with lib; let
|
||||
cmpLib = import ../cmp-helpers.nix attrs;
|
||||
cmpSourcesPluginNames = lib.attrValues cmpLib.pluginAndSourceNames;
|
||||
pluginModules = lists.map (name: cmpLib.mkCmpSourcePlugin {inherit name;}) cmpSourcesPluginNames;
|
||||
in
|
||||
{
|
||||
in {
|
||||
# For extra cmp plugins
|
||||
imports = [
|
||||
] ++ pluginModules;
|
||||
imports =
|
||||
[
|
||||
]
|
||||
++ pluginModules;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in with helpers; with lib;
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "fugitive";
|
||||
description = "Enable vim-fugitive";
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.gitgutter;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.gitgutter = {
|
||||
enable = mkEnableOption "gitgutter";
|
||||
|
@ -54,9 +57,9 @@ in
|
|||
};
|
||||
|
||||
signs = mkOption {
|
||||
type =
|
||||
let
|
||||
signOption = desc: mkOption {
|
||||
type = let
|
||||
signOption = desc:
|
||||
mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Sign for ${desc}";
|
||||
|
@ -166,10 +169,15 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
grepPackage = if builtins.isAttrs cfg.grep then [ cfg.grep.package ] else [ ];
|
||||
grepCommand = if builtins.isAttrs cfg.grep then cfg.grep.command else cfg.grep;
|
||||
config = let
|
||||
grepPackage =
|
||||
if builtins.isAttrs cfg.grep
|
||||
then [cfg.grep.package]
|
||||
else [];
|
||||
grepCommand =
|
||||
if builtins.isAttrs cfg.grep
|
||||
then cfg.grep.command
|
||||
else cfg.grep;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix args;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.gitmessenger = {
|
||||
enable = mkEnableOption "Enable the gitmessenger plugin";
|
||||
|
||||
|
@ -91,8 +91,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.gitmessenger;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix args;
|
||||
|
@ -33,8 +34,7 @@ with lib; let
|
|||
description = "Lua function definition";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.gitsigns = {
|
||||
enable = mkEnableOption "Enable gitsigns plugin";
|
||||
package = helpers.mkPackageOption "gitsigns" pkgs.vimPlugins.gitsigns-nvim;
|
||||
|
@ -76,8 +76,7 @@ in
|
|||
linehl = "GitSignsAddLn";
|
||||
};
|
||||
};
|
||||
worktrees =
|
||||
let
|
||||
worktrees = let
|
||||
worktreeModule = {
|
||||
options = {
|
||||
toplevel = mkOption {
|
||||
|
@ -164,8 +163,7 @@ in
|
|||
|
||||
Note: Virtual lines currently use the highlight `GitSignsDeleteVirtLn`.
|
||||
'';
|
||||
diffOpts =
|
||||
let
|
||||
diffOpts = let
|
||||
diffOptModule = {
|
||||
options = {
|
||||
algorithm =
|
||||
|
@ -316,14 +314,12 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.gitsigns;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraConfigLua =
|
||||
let
|
||||
extraConfigLua = let
|
||||
luaFnOrStrToObj = val:
|
||||
if val == null
|
||||
then null
|
||||
|
@ -350,8 +346,7 @@ in
|
|||
inherit (cfg.diffOpts) algorithm internal vertical linematch;
|
||||
indent_heuristic = cfg.diffOpts.indentHeuristic;
|
||||
};
|
||||
count_chars =
|
||||
let
|
||||
count_chars = let
|
||||
isStrInt = s: (builtins.match "[0-9]+" s) != null;
|
||||
in
|
||||
if cfg.countChars != null
|
||||
|
@ -380,11 +375,9 @@ in
|
|||
attach_to_untracked = cfg.attachToUntracked;
|
||||
update_debounce = cfg.updateDebounce;
|
||||
current_line_blame = cfg.currentLineBlame;
|
||||
current_line_blame_opts =
|
||||
let
|
||||
current_line_blame_opts = let
|
||||
cfgCl = cfg.currentLineBlameOpts;
|
||||
in
|
||||
{
|
||||
in {
|
||||
inherit (cfgCl) delay;
|
||||
virt_text = cfgCl.virtText;
|
||||
virt_text_pos = cfgCl.virtTextPos;
|
||||
|
@ -396,8 +389,7 @@ in
|
|||
word_diff = cfg.wordDiff;
|
||||
debug_mode = cfg.debugMode;
|
||||
};
|
||||
in
|
||||
''
|
||||
in ''
|
||||
require('gitsigns').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.neogit;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
|
@ -12,8 +16,7 @@ let
|
|||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.neogit = {
|
||||
enable = mkEnableOption "neogit";
|
||||
|
@ -203,9 +206,9 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = with cfg; helpers.toLuaObject {
|
||||
config = let
|
||||
setupOptions = with cfg;
|
||||
helpers.toLuaObject {
|
||||
inherit kind integrations signs sections mappings;
|
||||
disable_signs = disableSigns;
|
||||
disable_hint = disableHint;
|
||||
|
@ -218,10 +221,12 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
extraPlugins = with pkgs.vimPlugins;
|
||||
[
|
||||
cfg.package
|
||||
plenary-nvim
|
||||
] ++ optional cfg.integrations.diffview diffview-nvim;
|
||||
]
|
||||
++ optional cfg.integrations.diffview diffview-nvim;
|
||||
|
||||
extraPackages = [pkgs.git];
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
{ pkgs, lib, ... }@args:
|
||||
with lib; with import ../helpers.nix { inherit lib; };
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib;
|
||||
with import ../helpers.nix {inherit lib;};
|
||||
mkPlugin args {
|
||||
name = "ledger";
|
||||
description = "Enable ledger language features";
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.markdown-preview;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.markdown-preview = {
|
||||
enable = mkEnableOption "markdown-preview";
|
||||
|
@ -92,8 +95,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
previewOptions = mapAttrs (name: value: cfg.previewOptions.${name}) cfg.previewOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in with helpers; with lib;
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "nix";
|
||||
description = "Enable nix";
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options.plugins.plantuml-syntax = {
|
||||
|
@ -24,8 +24,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.plantuml-syntax;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options.plugins.rust-tools =
|
||||
let
|
||||
mkNullableOptionWithDefault =
|
||||
{ type
|
||||
, description
|
||||
, default
|
||||
,
|
||||
options.plugins.rust-tools = let
|
||||
mkNullableOptionWithDefault = {
|
||||
type,
|
||||
description,
|
||||
default,
|
||||
}:
|
||||
mkOption {
|
||||
type = types.nullOr type;
|
||||
|
@ -45,8 +43,7 @@ in {
|
|||
type = types.int;
|
||||
default = toString default;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
enable = mkEnableOption "rust tools plugins";
|
||||
package = helpers.mkPackageOption "rust-tools" pkgs.vimPlugins.rust-tools-nvim;
|
||||
serverPackage = mkOption {
|
||||
|
@ -157,16 +154,14 @@ in {
|
|||
}
|
||||
// (import ../nvim-lsp/rust-analyzer-config.nix lib);
|
||||
};
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.rust-tools;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [nvim-lspconfig cfg.package];
|
||||
extraPackages = [cfg.serverPackage];
|
||||
|
||||
plugins.lsp.postConfig =
|
||||
let
|
||||
plugins.lsp.postConfig = let
|
||||
setupOptions = {
|
||||
tools = {
|
||||
executor =
|
||||
|
@ -180,11 +175,9 @@ in {
|
|||
else null;
|
||||
|
||||
reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml;
|
||||
inlay_hints =
|
||||
let
|
||||
inlay_hints = let
|
||||
cfgIH = cfg.inlayHints;
|
||||
in
|
||||
{
|
||||
in {
|
||||
auto = cfgIH.auto;
|
||||
only_current_line = cfgIH.onlyCurrentLine;
|
||||
show_parameter_hints = cfgIH.showParameterHints;
|
||||
|
@ -197,22 +190,18 @@ in {
|
|||
highlight = cfgIH.highlight;
|
||||
};
|
||||
|
||||
hover_actions =
|
||||
let
|
||||
hover_actions = let
|
||||
cfgHA = cfg.hoverActions;
|
||||
in
|
||||
{
|
||||
in {
|
||||
border = cfgHA.border;
|
||||
max_width = cfgHA.maxWidth;
|
||||
max_height = cfgHA.maxHeight;
|
||||
auto_focus = cfgHA.autoFocus;
|
||||
};
|
||||
|
||||
crate_graph =
|
||||
let
|
||||
crate_graph = let
|
||||
cfgCG = cfg.crateGraph;
|
||||
in
|
||||
{
|
||||
in {
|
||||
backend = cfgCG.backend;
|
||||
output = cfgCG.output;
|
||||
full = cfgCG.full;
|
||||
|
@ -225,8 +214,7 @@ in {
|
|||
on_attach = {__raw = "__lspOnAttach";};
|
||||
};
|
||||
};
|
||||
in
|
||||
''
|
||||
in ''
|
||||
require('rust-tools').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
cfg = config.plugins.tagbar;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
with lib; {
|
||||
options.plugins.tagbar = {
|
||||
|
||||
enable = mkEnableOption "tagbar";
|
||||
|
||||
package = helpers.mkPackageOption "tagbar" pkgs.vimPlugins.tagbar;
|
||||
|
@ -25,7 +23,6 @@ with lib;
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraPackages = [pkgs.ctags];
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options.plugins.treesitter-context = {
|
||||
|
@ -45,8 +45,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.treesitter-context;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
options.plugins.treesitter-refactor =
|
||||
let
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
options.plugins.treesitter-refactor = let
|
||||
disable = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "List of languages to disable the module on";
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
enable =
|
||||
mkEnableOption
|
||||
"treesitter-refactor (requires plugins.treesitter.enable to be true)";
|
||||
|
@ -103,8 +100,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.treesitter-refactor;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
@ -122,11 +118,9 @@ in
|
|||
};
|
||||
navigation = {
|
||||
inherit (cfg.navigation) enable disable;
|
||||
keymaps =
|
||||
let
|
||||
keymaps = let
|
||||
cfgK = cfg.navigation.keymaps;
|
||||
in
|
||||
{
|
||||
in {
|
||||
goto_definition = cfgK.gotoDefinition;
|
||||
goto_definition_lsp_fallback = cfgK.gotoDefinitionLspFallback;
|
||||
list_definitions = cfgK.listDefinitons;
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.treesitter;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.treesitter = {
|
||||
enable = mkEnableOption "tree-sitter syntax highlighting";
|
||||
|
@ -32,8 +35,7 @@ in
|
|||
default =
|
||||
if cfg.nixGrammars
|
||||
then null
|
||||
else "$XDG_DATA_HOME/nvim/treesitter"
|
||||
;
|
||||
else "$XDG_DATA_HOME/nvim/treesitter";
|
||||
description = ''
|
||||
Location of the parsers to be installed by the plugin (only needed when nixGrammars is disabled).
|
||||
This default might not work on your own install, please make sure that $XDG_DATA_HOME is set if you want to use the default. Otherwise, change it to something that will work for you!
|
||||
|
@ -58,14 +60,13 @@ in
|
|||
description = "Custom capture group highlighting";
|
||||
};
|
||||
|
||||
incrementalSelection =
|
||||
let
|
||||
keymap = default: mkOption {
|
||||
incrementalSelection = let
|
||||
keymap = default:
|
||||
mkOption {
|
||||
type = types.str;
|
||||
inherit default;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
enable = mkEnableOption "incremental selection based on the named nodes from the grammar";
|
||||
keymaps = {
|
||||
initSelection = keymap "gnn";
|
||||
|
@ -93,18 +94,25 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
tsOptions = {
|
||||
config = let
|
||||
tsOptions =
|
||||
{
|
||||
highlight = {
|
||||
enable = cfg.enable;
|
||||
disable = if (cfg.disabledLanguages != [ ]) then cfg.disabledLanguages else null;
|
||||
disable =
|
||||
if (cfg.disabledLanguages != [])
|
||||
then cfg.disabledLanguages
|
||||
else null;
|
||||
|
||||
custom_captures = if (cfg.customCaptures != { }) then cfg.customCaptures else null;
|
||||
custom_captures =
|
||||
if (cfg.customCaptures != {})
|
||||
then cfg.customCaptures
|
||||
else null;
|
||||
};
|
||||
|
||||
incremental_selection =
|
||||
if cfg.incrementalSelection.enable then {
|
||||
if cfg.incrementalSelection.enable
|
||||
then {
|
||||
enable = true;
|
||||
keymaps = {
|
||||
init_selection = cfg.incrementalSelection.keymaps.initSelection;
|
||||
|
@ -112,27 +120,37 @@ in
|
|||
scope_incremental = cfg.incrementalSelection.keymaps.scopeIncremental;
|
||||
node_decremental = cfg.incrementalSelection.keymaps.nodeDecremental;
|
||||
};
|
||||
} else null;
|
||||
}
|
||||
else null;
|
||||
|
||||
indent =
|
||||
if cfg.indent then {
|
||||
if cfg.indent
|
||||
then {
|
||||
enable = true;
|
||||
} else null;
|
||||
}
|
||||
else null;
|
||||
|
||||
ensure_installed = if cfg.nixGrammars then [ ] else cfg.ensureInstalled;
|
||||
ensure_installed =
|
||||
if cfg.nixGrammars
|
||||
then []
|
||||
else cfg.ensureInstalled;
|
||||
ignore_install = cfg.ignoreInstall;
|
||||
parser_install_dir = cfg.parserInstallDir;
|
||||
} // cfg.moduleConfig;
|
||||
}
|
||||
// cfg.moduleConfig;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraConfigLua = (optionalString (cfg.parserInstallDir != null) ''
|
||||
extraConfigLua =
|
||||
(optionalString (cfg.parserInstallDir != null) ''
|
||||
vim.opt.runtimepath:append("${cfg.parserInstallDir}")
|
||||
'') + ''
|
||||
'')
|
||||
+ ''
|
||||
require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions})
|
||||
'';
|
||||
|
||||
extraPlugins = with pkgs; if cfg.nixGrammars then
|
||||
[ (cfg.package.withPlugins (_: cfg.grammarPackages)) ]
|
||||
extraPlugins = with pkgs;
|
||||
if cfg.nixGrammars
|
||||
then [(cfg.package.withPlugins (_: cfg.grammarPackages))]
|
||||
else [cfg.package];
|
||||
extraPackages = [pkgs.tree-sitter pkgs.nodejs];
|
||||
|
||||
|
@ -142,4 +160,3 @@ in
|
|||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
cfg = config.plugins.vimtex;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
with lib; {
|
||||
options.plugins.vimtex = {
|
||||
|
||||
enable = mkEnableOption "vimtex";
|
||||
|
||||
package = helpers.mkPackageOption "vimtex" pkgs.vimPlugins.vimtex;
|
||||
|
@ -24,14 +22,14 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
globals = {
|
||||
config = let
|
||||
globals =
|
||||
{
|
||||
enabled = cfg.enable;
|
||||
} // cfg.extraConfig;
|
||||
}
|
||||
// cfg.extraConfig;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
# Usefull for inverse search
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in with helpers; with lib;
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "zig";
|
||||
description = "Enable zig";
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.null-ls;
|
||||
helpers = (import ../helpers.nix { inherit lib; });
|
||||
in
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.null-ls;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
imports = [
|
||||
./servers.nix
|
||||
];
|
||||
|
@ -36,8 +39,7 @@ in
|
|||
# };
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
debug = cfg.debug;
|
||||
sources = cfg.sourcesItems;
|
||||
|
|
|
@ -1,30 +1,41 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{
|
||||
mkServer =
|
||||
{ name
|
||||
, sourceType
|
||||
, description ? "${name} source, for null-ls."
|
||||
, package ? null
|
||||
, extraPackages ? [ ]
|
||||
, ...
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
mkServer = {
|
||||
name,
|
||||
sourceType,
|
||||
description ? "${name} source, for null-ls.",
|
||||
package ? null,
|
||||
extraPackages ? [],
|
||||
...
|
||||
}:
|
||||
# returns a module
|
||||
{ pkgs, config, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix args;
|
||||
cfg = config.plugins.null-ls.sources.${sourceType}.${name};
|
||||
# does this evaluate package?
|
||||
packageOption = if package == null then { } else {
|
||||
packageOption =
|
||||
if package == null
|
||||
then {}
|
||||
else {
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = package;
|
||||
description = "Package to use for ${name} by null-ls";
|
||||
};
|
||||
};
|
||||
in
|
||||
in {
|
||||
options.plugins.null-ls.sources.${sourceType}.${name} =
|
||||
{
|
||||
options.plugins.null-ls.sources.${sourceType}.${name} = {
|
||||
enable = mkEnableOption description;
|
||||
|
||||
# TODO: withArgs can exist outside of the module in a generalized manner
|
||||
|
@ -37,20 +48,22 @@
|
|||
# '\'{ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }'\'
|
||||
# '';
|
||||
};
|
||||
} // packageOption;
|
||||
}
|
||||
// packageOption;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Does this evaluate package?
|
||||
extraPackages = extraPackages ++ optional (package != null) cfg.package;
|
||||
|
||||
# Add source to list of sources
|
||||
plugins.null-ls.sourcesItems =
|
||||
let
|
||||
plugins.null-ls.sourcesItems = let
|
||||
sourceItem = "${sourceType}.${name}";
|
||||
withArgs = if (isNull cfg.withArgs) then sourceItem else "${sourceItem}.with ${cfg.withArgs}";
|
||||
withArgs =
|
||||
if (isNull cfg.withArgs)
|
||||
then sourceItem
|
||||
else "${sourceItem}.with ${cfg.withArgs}";
|
||||
finalString = ''require("null-ls").builtins.${withArgs}'';
|
||||
in
|
||||
[ (helpers.mkRaw finalString) ];
|
||||
in [(helpers.mkRaw finalString)];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
helpers = import ./helpers.nix args;
|
||||
serverData = {
|
||||
code_actions = {
|
||||
|
@ -65,18 +69,18 @@ let
|
|||
# sourceType = "formatting";
|
||||
# packages = [...];
|
||||
# }]
|
||||
serverDataFormatted = lib.mapAttrsToList
|
||||
(sourceType: sourceSet:
|
||||
serverDataFormatted =
|
||||
lib.mapAttrsToList
|
||||
(
|
||||
sourceType: sourceSet:
|
||||
lib.mapAttrsToList (name: attrs: attrs // {inherit sourceType name;}) sourceSet
|
||||
)
|
||||
serverData;
|
||||
dataFlattened = lib.flatten serverDataFormatted;
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = lib.lists.map (helpers.mkServer) dataFlattened;
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.null-ls;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
helpers = import ./helpers.nix args;
|
||||
servers = [
|
||||
{
|
||||
|
@ -243,7 +247,6 @@ let
|
|||
cmd = cfg: ["haskell-language-server-wrapper"];
|
||||
}
|
||||
];
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = lib.lists.map (helpers.mkLsp) servers;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lsp;
|
||||
helpers = (import ../helpers.nix { inherit lib; });
|
||||
in
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lsp;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in {
|
||||
imports = [
|
||||
./basic-servers.nix
|
||||
];
|
||||
|
@ -14,7 +17,8 @@ in
|
|||
enable = mkEnableOption "neovim's built-in LSP";
|
||||
|
||||
enabledServers = mkOption {
|
||||
type = with types; listOf (oneOf [
|
||||
type = with types;
|
||||
listOf (oneOf [
|
||||
str
|
||||
(submodule {
|
||||
options = {
|
||||
|
@ -60,10 +64,10 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
runWrappers = wrappers: s:
|
||||
if wrappers == [ ] then s
|
||||
if wrappers == []
|
||||
then s
|
||||
else (head wrappers) (runWrappers (tail wrappers) s);
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -1,51 +1,65 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
|
||||
{
|
||||
mkLsp =
|
||||
{ name
|
||||
, description ? "Enable ${name}."
|
||||
, serverName ? name
|
||||
, package ? pkgs.${name}
|
||||
, extraPackages ? { }
|
||||
, cmd ? (cfg: null)
|
||||
, settings ? (cfg: { })
|
||||
, settingsOptions ? { }
|
||||
, ...
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
mkLsp = {
|
||||
name,
|
||||
description ? "Enable ${name}.",
|
||||
serverName ? name,
|
||||
package ? pkgs.${name},
|
||||
extraPackages ? {},
|
||||
cmd ? (cfg: null),
|
||||
settings ? (cfg: {}),
|
||||
settingsOptions ? {},
|
||||
...
|
||||
}:
|
||||
# returns a module
|
||||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lsp.servers.${name};
|
||||
|
||||
packageOption =
|
||||
if package != null then {
|
||||
if package != null
|
||||
then {
|
||||
package = mkOption {
|
||||
default = package;
|
||||
type = types.nullOr types.package;
|
||||
};
|
||||
} else { };
|
||||
in
|
||||
{
|
||||
}
|
||||
else {};
|
||||
in {
|
||||
options = {
|
||||
plugins.lsp.servers.${name} = {
|
||||
plugins.lsp.servers.${name} =
|
||||
{
|
||||
enable = mkEnableOption description;
|
||||
settings = settingsOptions;
|
||||
} // packageOption;
|
||||
}
|
||||
// packageOption;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable
|
||||
config =
|
||||
mkIf cfg.enable
|
||||
{
|
||||
extraPackages = (optional (package != null) cfg.package) ++
|
||||
(mapAttrsToList (name: _: cfg."${name}Package") extraPackages);
|
||||
extraPackages =
|
||||
(optional (package != null) cfg.package)
|
||||
++ (mapAttrsToList (name: _: cfg."${name}Package") extraPackages);
|
||||
|
||||
plugins.lsp.enabledServers = [{
|
||||
plugins.lsp.enabledServers = [
|
||||
{
|
||||
name = serverName;
|
||||
extraOptions = {
|
||||
cmd = cmd cfg;
|
||||
settings = settings cfg.settings;
|
||||
};
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lsp-lines;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.lsp-lines = {
|
||||
enable = mkEnableOption "lsp_lines.nvim";
|
||||
|
@ -19,14 +22,15 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
diagnosticConfig = {
|
||||
virtual_text = false;
|
||||
virtual_lines =
|
||||
if cfg.currentLine then {
|
||||
if cfg.currentLine
|
||||
then {
|
||||
only_current_line = true;
|
||||
} else true;
|
||||
}
|
||||
else true;
|
||||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lspsaga;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.lspsaga = {
|
||||
enable = mkEnableOption "lspsaga.nvim";
|
||||
|
@ -107,15 +110,14 @@ in
|
|||
description = "Maximum finder preview lines";
|
||||
};
|
||||
|
||||
keys =
|
||||
let
|
||||
defaultKeyOpt = desc: mkOption {
|
||||
keys = let
|
||||
defaultKeyOpt = desc:
|
||||
mkOption {
|
||||
description = desc;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
finderAction = {
|
||||
open = defaultKeyOpt "Open from finder";
|
||||
vsplit = defaultKeyOpt "Vertical split in finder";
|
||||
|
@ -145,10 +147,15 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
notDefault = default: opt: if (opt != default) then opt else null;
|
||||
notEmpty = opt: if ((filterAttrs (_: v: v != null) opt) != { }) then opt else null;
|
||||
config = let
|
||||
notDefault = default: opt:
|
||||
if (opt != default)
|
||||
then opt
|
||||
else null;
|
||||
notEmpty = opt:
|
||||
if ((filterAttrs (_: v: v != null) opt) != {})
|
||||
then opt
|
||||
else null;
|
||||
notNull = opt: opt;
|
||||
lspsagaConfig = {
|
||||
use_saga_diagnostic_sign = notDefault true cfg.signs.use;
|
||||
|
@ -174,18 +181,19 @@ in
|
|||
|
||||
rename_prompt_prefix = notNull cfg.renamePromptPrefix;
|
||||
|
||||
border_style =
|
||||
let
|
||||
border_style = let
|
||||
borderStyle =
|
||||
if cfg.borderStyle == "thin" then 1
|
||||
else if cfg.borderStyle == "rounded" then 2
|
||||
else if cfg.borderStyle == "thick" then 3
|
||||
if cfg.borderStyle == "thin"
|
||||
then 1
|
||||
else if cfg.borderStyle == "rounded"
|
||||
then 2
|
||||
else if cfg.borderStyle == "thick"
|
||||
then 3
|
||||
else null;
|
||||
in
|
||||
borderStyle;
|
||||
|
||||
finder_action_keys =
|
||||
let
|
||||
finder_action_keys = let
|
||||
keys = {
|
||||
open = notNull cfg.keys.finderAction.open;
|
||||
vsplit = notNull cfg.keys.finderAction.vsplit;
|
||||
|
@ -197,8 +205,7 @@ in
|
|||
in
|
||||
notEmpty keys;
|
||||
|
||||
code_action_keys =
|
||||
let
|
||||
code_action_keys = let
|
||||
keys = {
|
||||
quit = notNull cfg.keys.codeAction.quit;
|
||||
exec = notNull cfg.keys.codeAction.exec;
|
||||
|
@ -208,7 +215,6 @@ in
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = ''
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{ pkgs
|
||||
, lib
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib; {
|
||||
|
@ -63,8 +63,7 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.nvim-lightbulb;
|
||||
setupOptions = {
|
||||
inherit (cfg) ignore sign autocmd;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# THIS FILE IS AUTOGENERATED DO NOT EDIT
|
||||
lib: with lib; {
|
||||
lib:
|
||||
with lib; {
|
||||
"assist" = {
|
||||
"expressionFillDefault" = mkOption {
|
||||
type = types.nullOr (types.enum ["todo" "default"]);
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
cfg = config.plugins.trouble;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# This is for plugins not in nixpkgs
|
||||
# e.g. intellitab.nvim
|
||||
# Ideally, in the future, this would all be specified as a flake input!
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
{pkgs, ...}: {
|
||||
intellitab-nvim = pkgs.vimUtils.buildVimPlugin rec {
|
||||
pname = "intellitab-nvim";
|
||||
version = "a6c1a505865f6131866d609c52440306e9914b16";
|
||||
|
@ -96,9 +95,8 @@
|
|||
sha256 = "sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=";
|
||||
};
|
||||
|
||||
|
||||
|
||||
passthru.python3Dependencies = ps: with ps; [
|
||||
passthru.python3Dependencies = ps:
|
||||
with ps; [
|
||||
pynvim
|
||||
jupyter-client
|
||||
ueberzug
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.packer;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.packer = {
|
||||
enable = mkEnableOption "packer.nvim";
|
||||
|
@ -13,7 +16,8 @@ in
|
|||
type = types.listOf (types.oneOf [
|
||||
types.str
|
||||
(with types; let
|
||||
mkOpt = type: desc: mkOption {
|
||||
mkOpt = type: desc:
|
||||
mkOption {
|
||||
type = nullOr type;
|
||||
default = null;
|
||||
description = desc;
|
||||
|
@ -63,15 +67,26 @@ in
|
|||
extraPlugins = [(pkgs.vimPlugins.packer-nvim.overrideAttrs (_: {pname = "packer.nvim";}))];
|
||||
extraPackages = [pkgs.git];
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
plugins = map
|
||||
extraConfigLua = let
|
||||
plugins =
|
||||
map
|
||||
(plugin:
|
||||
if isAttrs plugin then
|
||||
mapAttrs' (k: v: { name = if k == "name" then "@" else k; value = v; }) plugin
|
||||
if isAttrs plugin
|
||||
then
|
||||
mapAttrs' (k: v: {
|
||||
name =
|
||||
if k == "name"
|
||||
then "@"
|
||||
else k;
|
||||
value = v;
|
||||
})
|
||||
plugin
|
||||
else plugin)
|
||||
cfg.plugins;
|
||||
packedPlugins = if length plugins == 1 then head plugins else plugins;
|
||||
packedPlugins =
|
||||
if length plugins == 1
|
||||
then head plugins
|
||||
else plugins;
|
||||
in
|
||||
mkIf (cfg.plugins != []) ''
|
||||
require('packer').startup(function()
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.luasnip;
|
||||
helpers = import ../../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.luasnip = {
|
||||
enable = mkEnableOption "Enable luasnip";
|
||||
|
||||
|
@ -38,7 +41,8 @@ in
|
|||
# TODO: add option to also include the default runtimepath
|
||||
paths = mkOption {
|
||||
default = null;
|
||||
type = with types; nullOr (oneOf
|
||||
type = with types;
|
||||
nullOr (oneOf
|
||||
[
|
||||
str
|
||||
path
|
||||
|
@ -75,15 +79,12 @@ in
|
|||
# TODO: add support for lua
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
|
||||
fromVscodeLoaders = lists.map
|
||||
(loader:
|
||||
let
|
||||
config = let
|
||||
fromVscodeLoaders =
|
||||
lists.map
|
||||
(loader: let
|
||||
options = attrsets.getAttrs ["paths" "exclude" "include"] loader;
|
||||
in
|
||||
''
|
||||
in ''
|
||||
require("luasnip.loaders.from_vscode").${optionalString loader.lazyLoad "lazy_"}load(${helpers.toLuaObject options})
|
||||
'')
|
||||
cfg.fromVscode;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.airline;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
|
@ -10,8 +14,7 @@ let
|
|||
type = sectionType;
|
||||
description = "Configuration for this section. Can be either a statusline-format string or a list of modules to be passed to airline#section#create_*.";
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.airline = {
|
||||
enable = mkEnableOption "airline";
|
||||
|
@ -33,7 +36,8 @@ in
|
|||
sections = mkOption {
|
||||
description = "Statusbar sections";
|
||||
default = null;
|
||||
type = with types; nullOr (submodule {
|
||||
type = with types;
|
||||
nullOr (submodule {
|
||||
options = {
|
||||
a = sectionOption;
|
||||
b = sectionOption;
|
||||
|
@ -59,21 +63,24 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
sections = {};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
extraPlugins = with pkgs.vimPlugins;
|
||||
[
|
||||
cfg.package
|
||||
] ++ optional (!isNull cfg.theme) vim-airline-themes;
|
||||
globals = {
|
||||
]
|
||||
++ optional (!isNull cfg.theme) vim-airline-themes;
|
||||
globals =
|
||||
{
|
||||
airline.extensions = cfg.extensions;
|
||||
|
||||
airline_statusline_ontop = mkIf cfg.onTop 1;
|
||||
airline_powerline_fonts = mkIf (cfg.powerline) 1;
|
||||
|
||||
airline_theme = mkIf (!isNull cfg.theme) cfg.theme;
|
||||
} // sections;
|
||||
}
|
||||
// sections;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lightline;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.lightline = {
|
||||
enable = mkEnableOption "lightline";
|
||||
|
@ -51,11 +54,9 @@ in
|
|||
active = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.submodule {
|
||||
options =
|
||||
let
|
||||
options = let
|
||||
listType = with types; nullOr (listOf (listOf str));
|
||||
in
|
||||
{
|
||||
in {
|
||||
left = mkOption {
|
||||
type = listType;
|
||||
description = "List of components that will show up on the left side of the bar";
|
||||
|
@ -79,8 +80,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
configAttrs = filterAttrs (_: v: v != null) {
|
||||
inherit (cfg) colorscheme active component componentFunction modeMap;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.lualine;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
separators = mkOption {
|
||||
|
@ -52,8 +56,7 @@ let
|
|||
]));
|
||||
default = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.lualine = {
|
||||
enable = mkEnableOption "lualine";
|
||||
|
@ -79,8 +82,7 @@ in
|
|||
alwaysDivideMiddle = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description =
|
||||
"When true, left_sections (a,b,c) can't take over entire statusline";
|
||||
description = "When true, left_sections (a,b,c) can't take over entire statusline";
|
||||
};
|
||||
|
||||
sections = mkOption {
|
||||
|
@ -121,10 +123,22 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
config =
|
||||
let
|
||||
processComponent = x: (if isAttrs x then processTableComponent else id) x;
|
||||
processTableComponent = { name, icons_enabled, icon, separator, extraConfig }: mergeAttrs
|
||||
config = let
|
||||
processComponent = x:
|
||||
(
|
||||
if isAttrs x
|
||||
then processTableComponent
|
||||
else id
|
||||
)
|
||||
x;
|
||||
processTableComponent = {
|
||||
name,
|
||||
icons_enabled,
|
||||
icon,
|
||||
separator,
|
||||
extraConfig,
|
||||
}:
|
||||
mergeAttrs
|
||||
{
|
||||
"@" = name;
|
||||
inherit icons_enabled icon separator;
|
||||
|
@ -148,7 +162,6 @@ in
|
|||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPackages = [pkgs.git];
|
||||
extraConfigLua =
|
||||
''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
|
||||
extraConfigLua = ''require("lualine").setup(${helpers.toLuaObject setupOptions})'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
with lib; let
|
||||
cfg = config.plugins.telescope;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = [
|
||||
./frecency.nix
|
||||
./fzf-native.nix
|
||||
|
@ -68,14 +67,14 @@ in
|
|||
let $BAT_THEME = '${cfg.highlightTheme}'
|
||||
'';
|
||||
|
||||
extraConfigLua =
|
||||
let
|
||||
options = {
|
||||
extraConfigLua = let
|
||||
options =
|
||||
{
|
||||
extensions = cfg.extensionConfig;
|
||||
defaults = cfg.defaults;
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
do
|
||||
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.telescope.extensions.frecency;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.telescope.extensions.frecency = {
|
||||
enable = mkEnableOption "frecency";
|
||||
|
||||
|
@ -47,8 +50,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
configuration = {
|
||||
db_root = cfg.dbRoot;
|
||||
default_workspace = cfg.defaultWorkspace;
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.telescope.extensions.fzf-native;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.telescope.extensions.fzf-native = {
|
||||
enable = mkEnableOption "Enable fzf-native";
|
||||
|
||||
|
@ -38,7 +41,8 @@ in
|
|||
override_file_sorter = cfg.overrideFileSorter;
|
||||
case_mode = cfg.caseMode;
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
|
||||
plugins.telescope.enabledExtensions = ["fzf"];
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
{ pkgs, config, lib, ...}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.telescope.extensions.fzy-native;
|
||||
in
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.telescope.extensions.fzy-native;
|
||||
in {
|
||||
options.plugins.telescope.extensions.fzy-native = {
|
||||
enable = mkEnableOption "Enable fzy-native";
|
||||
|
||||
|
@ -24,7 +27,8 @@ in
|
|||
override_generic_sorter = cfg.overrideGenericSorter;
|
||||
override_file_sorter = cfg.overrideFileSorter;
|
||||
};
|
||||
in mkIf cfg.enable {
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [pkgs.vimPlugins.telescope-fzy-native-nvim];
|
||||
|
||||
plugins.telescope.enabledExtensions = ["fzy_native"];
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.telescope.extensions.media_files;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.telescope.extensions.media_files = {
|
||||
enable = mkEnableOption "Enable media_files extension for telescope";
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.telescope.extensions.project-nvim;
|
||||
in
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.telescope.extensions.project-nvim;
|
||||
in {
|
||||
options.plugins.telescope.extensions.project-nvim = {
|
||||
enable = mkEnableOption "project-nvim telescope extension";
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.comment-nvim;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.comment-nvim = {
|
||||
enable = mkEnableOption "Enable comment-nvim";
|
||||
|
@ -88,8 +91,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
setupOptions = {
|
||||
padding = cfg.padding;
|
||||
sticky = cfg.sticky;
|
||||
|
@ -101,7 +103,6 @@ in
|
|||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraConfigLua =
|
||||
''require("Comment").setup${helpers.toLuaObject setupOptions}'';
|
||||
extraConfigLua = ''require("Comment").setup${helpers.toLuaObject setupOptions}'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.commentary;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
# TODO Add support for aditional filetypes. This requires autocommands!
|
||||
|
||||
options = {
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.dashboard;
|
||||
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.dashboard = {
|
||||
enable = mkEnableOption "dashboard";
|
||||
|
@ -107,8 +110,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
custom_header = cfg.header;
|
||||
custom_footer = cfg.footer;
|
||||
|
@ -132,8 +134,7 @@ in
|
|||
extraConfigLua = ''
|
||||
local dashboard = require("dashboard")
|
||||
|
||||
${toString (mapAttrsToList (n: v:
|
||||
"dashboard.${n} = ${helpers.toLuaObject v}\n")
|
||||
${toString (mapAttrsToList (n: v: "dashboard.${n} = ${helpers.toLuaObject v}\n")
|
||||
filteredOptions)}
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.easyescape;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.easyescape = {
|
||||
enable = mkEnableOption "Enable easyescape";
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
eitherAttrsStrInt = with types; let
|
||||
strInt = either str int;
|
||||
in either strInt (attrsOf (either strInt (attrsOf strInt)));
|
||||
in with helpers;
|
||||
in
|
||||
either strInt (attrsOf (either strInt (attrsOf strInt)));
|
||||
in
|
||||
with helpers;
|
||||
mkPlugin attrs {
|
||||
name = "emmet";
|
||||
description = "Enable emmet";
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in with helpers; with lib;
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "endwise";
|
||||
description = "Enable vim-endwise";
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.floaterm;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.floaterm = {
|
||||
enable = mkEnableOption "floaterm";
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in with helpers; with lib;
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "goyo";
|
||||
description = "Enable goyo.vim";
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.harpoon;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
|
@ -15,8 +19,7 @@ let
|
|||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.harpoon = {
|
||||
enable = mkEnableOption "harpoon";
|
||||
|
||||
|
@ -73,17 +76,16 @@ in
|
|||
Menu window height
|
||||
'';
|
||||
|
||||
borderChars = helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||
borderChars =
|
||||
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
|
||||
"[ \"─\" \"│\" \"─\" \"│\" \"╭\" \"╮\" \"╯\" \"╰\" ]"
|
||||
"Border characters"
|
||||
;
|
||||
"Border characters";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
projects = builtins.mapAttrs
|
||||
config = let
|
||||
projects =
|
||||
builtins.mapAttrs
|
||||
(
|
||||
name: value: {
|
||||
term.cmds = value.termCommands;
|
||||
|
@ -119,4 +121,3 @@ in
|
|||
'';
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{ lib
|
||||
, pkgs
|
||||
, config
|
||||
, ...
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
helpers = import ../helpers.nix args;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.indent-blankline = {
|
||||
enable = mkEnableOption "indent-blankline.nvim";
|
||||
|
||||
|
@ -248,8 +248,7 @@ in
|
|||
helpers.defaultNullOpts.mkBool false "Turns deprecation warning messages off.";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
cfg = config.plugins.indent-blankline;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.intellitab;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
defs = import ../plugin-defs.nix {inherit pkgs;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.intellitab = {
|
||||
enable = mkEnableOption "intellitab.nvim";
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.magma-nvim;
|
||||
plugins = import ../plugin-defs.nix {inherit pkgs;};
|
||||
package = pkgs.fetchFromGitHub {
|
||||
|
@ -17,8 +21,7 @@ in {
|
|||
type = types.enum ["none" "ueberzug" "kitty"];
|
||||
default = "none";
|
||||
example = "ueberzug";
|
||||
description =
|
||||
" This configures how to display images. The following options are available:
|
||||
description = " This configures how to display images. The following options are available:
|
||||
none -- don't show imagesmagma_image_provider.
|
||||
ueberzug -- use Ueberzug to display images.
|
||||
kitty -- use the Kitty protocol to display images.";
|
||||
|
@ -27,8 +30,7 @@ in {
|
|||
type = types.bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description =
|
||||
" If this is true, then whenever you have an active cell its output window will be automatically shown.
|
||||
description = " If this is true, then whenever you have an active cell its output window will be automatically shown.
|
||||
If this is false, then the output window will only be automatically shown when you've just evaluated the code. So, if you take your cursor out of the cell, and then come back, the output window won't be opened (but the cell will be highlighted). This means that there will be nothing covering your code. You can then open the output window at will using :MagmaShowOutput.";
|
||||
};
|
||||
|
||||
|
@ -36,60 +38,54 @@ in {
|
|||
type = types.bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description =
|
||||
" If this is true, then text output in the output window will be wrapped (akin to set wrap).";
|
||||
description = " If this is true, then text output in the output window will be wrapped (akin to set wrap).";
|
||||
};
|
||||
|
||||
output_window_borders = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
example = false;
|
||||
description =
|
||||
" If this is true, then the output window will have rounded borders. If it is false, it will have no borders.";
|
||||
description = " If this is true, then the output window will have rounded borders. If it is false, it will have no borders.";
|
||||
};
|
||||
|
||||
cell_highlight_group = mkOption {
|
||||
type = types.str;
|
||||
default = "CursorLine";
|
||||
# example = "";
|
||||
description =
|
||||
" The highlight group to be used for highlighting cells.";
|
||||
description = " The highlight group to be used for highlighting cells.";
|
||||
};
|
||||
save_path = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description =
|
||||
"Where to save/load with :MagmaSave and :MagmaLoad (with no parameters).
|
||||
description = "Where to save/load with :MagmaSave and :MagmaLoad (with no parameters).
|
||||
The generated file is placed in this directory, with the filename itself being the buffer's name, with % replaced by %% and / replaced by %, and postfixed with the extension .json.";
|
||||
};
|
||||
show_mimetype_debug = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description =
|
||||
" If this is true, then before any non-iostream output chunk, Magma shows the mimetypes it received for it.
|
||||
description = " If this is true, then before any non-iostream output chunk, Magma shows the mimetypes it received for it.
|
||||
This is meant for debugging and adding new mimetypes.";
|
||||
};
|
||||
package = mkOption {
|
||||
type = types.nullOr types.package;
|
||||
default = null;
|
||||
example =
|
||||
"package = pkgs.fetchFromGitHub {
|
||||
example = "package = pkgs.fetchFromGitHub {
|
||||
owner = \"WhiteBlackGoose\";
|
||||
repo = \"magma-nvim-goose\";
|
||||
rev = version;
|
||||
sha256 = \"sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=\";} ";
|
||||
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ (
|
||||
if cfg.package != null then plugins.magma-nvim.override {src = cfg.package;} else plugins.magma-nvim
|
||||
)];
|
||||
|
||||
extraPlugins = [
|
||||
(
|
||||
if cfg.package != null
|
||||
then plugins.magma-nvim.override {src = cfg.package;}
|
||||
else plugins.magma-nvim
|
||||
)
|
||||
];
|
||||
|
||||
globals = {
|
||||
magma_image_provider =
|
||||
|
@ -99,13 +95,11 @@ in {
|
|||
magma_wrap_output = mkIf (!cfg.wrap_output) cfg.wrap_output;
|
||||
magma_output_window_borders =
|
||||
mkIf (!cfg.output_window_borders) cfg.output_window_borders;
|
||||
magma_highlight_group = mkIf (cfg.cell_highlight_group != "CursorLine")
|
||||
magma_highlight_group =
|
||||
mkIf (cfg.cell_highlight_group != "CursorLine")
|
||||
cfg.cell_highlight_group;
|
||||
magma_show_mimetype_debug =
|
||||
mkIf cfg.show_mimetype_debug cfg.show_mimetype_debug;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.mark-radar;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
defs = import ../plugin-defs.nix {inherit pkgs;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.mark-radar = {
|
||||
enable = mkEnableOption "mark-radar";
|
||||
|
||||
|
@ -33,8 +35,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
opts = helpers.toLuaObject {
|
||||
inherit (cfg) highlight_group background_highlight_group;
|
||||
set_default_mappings = cfg.set_default_keybinds;
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.notify;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
icon = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.notify = {
|
||||
enable = mkEnableOption "notify";
|
||||
|
||||
|
@ -49,8 +52,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
setupOptions = with cfg; {
|
||||
stages = stages;
|
||||
timeout = timeout;
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.nvim-autopairs;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.nvim-autopairs = {
|
||||
enable = mkEnableOption "nvim-autopairs";
|
||||
|
||||
|
@ -41,8 +44,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
pairs_map = cfg.pairs;
|
||||
disable_filetype = cfg.disabledFiletypes;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.nvim-colorizer;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
|
||||
|
@ -84,12 +87,9 @@ let
|
|||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.nvim-colorizer = {
|
||||
|
||||
enable = mkEnableOption "nvim-colorizer";
|
||||
|
||||
package = helpers.mkPackageOption "nvim-colorizer" pkgs.vimPlugins.nvim-colorizer-lua;
|
||||
|
@ -100,11 +100,13 @@ in
|
|||
types.listOf (types.oneOf [
|
||||
types.str
|
||||
(types.submodule {
|
||||
options = {
|
||||
options =
|
||||
{
|
||||
language = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
} // colorizer-options;
|
||||
}
|
||||
// colorizer-options;
|
||||
})
|
||||
])
|
||||
);
|
||||
|
@ -131,21 +133,23 @@ in
|
|||
extraPlugins = [cfg.package];
|
||||
|
||||
extraConfigLua = let
|
||||
|
||||
filetypes = if (cfg.fileTypes != null)
|
||||
then (
|
||||
filetypes =
|
||||
if (cfg.fileTypes != null)
|
||||
then
|
||||
(
|
||||
let
|
||||
list = map (
|
||||
v: if builtins.isAttrs v
|
||||
list =
|
||||
map (
|
||||
v:
|
||||
if builtins.isAttrs v
|
||||
then v.language + " = " + helpers.toLuaObject (builtins.removeAttrs v ["language"])
|
||||
else "'${v}'"
|
||||
) cfg.fileTypes;
|
||||
in "{" + (concatStringsSep "," list) + "}"
|
||||
)
|
||||
else
|
||||
"nil"
|
||||
;
|
||||
|
||||
cfg.fileTypes;
|
||||
in
|
||||
"{" + (concatStringsSep "," list) + "}"
|
||||
)
|
||||
else "nil";
|
||||
in ''
|
||||
require("colorizer").setup({
|
||||
filetypes = ${filetypes},
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args:
|
||||
with lib; let
|
||||
cfg = config.plugins.nvim-tree;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
optionWarnings = import ../../lib/option-warnings.nix args;
|
||||
basePluginPath = ["plugins" "nvim-tree"];
|
||||
in
|
||||
{
|
||||
in {
|
||||
imports = [
|
||||
(optionWarnings.mkRenamedOption {
|
||||
option = basePluginPath ++ ["updateCwd"];
|
||||
|
@ -102,15 +105,14 @@ in
|
|||
description = "Enable diagnostics";
|
||||
};
|
||||
|
||||
icons =
|
||||
let
|
||||
diagnosticOption = desc: mkOption {
|
||||
icons = let
|
||||
diagnosticOption = desc:
|
||||
mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = desc;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
hint = diagnosticOption "Hints";
|
||||
info = diagnosticOption "Info";
|
||||
warning = diagnosticOption "Warning";
|
||||
|
@ -233,8 +235,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
options = {
|
||||
disable_netrw = cfg.disableNetrw;
|
||||
hijack_netrw = cfg.hijackNetrw;
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.project-nvim;
|
||||
helpers = import ../helpers.nix {inherit lib pkgs;};
|
||||
in
|
||||
{
|
||||
options.plugins.project-nvim = helpers.extraOptionsOptions // {
|
||||
in {
|
||||
options.plugins.project-nvim =
|
||||
helpers.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "project.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "project-nvim" pkgs.vimPlugins.project-nvim;
|
||||
|
@ -54,12 +59,11 @@ in
|
|||
type = types.nullOr (types.either types.str helpers.rawType);
|
||||
default = null;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options = {
|
||||
config = let
|
||||
options =
|
||||
{
|
||||
manual_mode = cfg.manualMode;
|
||||
detection_methods = cfg.detectionMethods;
|
||||
patterns = cfg.patterns;
|
||||
|
@ -69,7 +73,8 @@ in
|
|||
silent_chdir = cfg.silentChdir;
|
||||
scope_schdir = cfg.scopeChdir;
|
||||
data_path = cfg.dataPath;
|
||||
} // cfg.extraOptions;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.specs;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.plugins.specs = {
|
||||
enable = mkEnableOption "specs-nvim";
|
||||
|
||||
|
@ -80,7 +83,8 @@ in
|
|||
type = types.submodule {
|
||||
options = {
|
||||
builtin = mkOption {
|
||||
type = types.nullOr
|
||||
type =
|
||||
types.nullOr
|
||||
(types.enum ["shrink_resizer" "slide_resizer" "empty_resizer"]);
|
||||
default = "shrink_resizer";
|
||||
};
|
||||
|
@ -110,31 +114,36 @@ in
|
|||
type = with types; listOf string;
|
||||
default = ["nofile"];
|
||||
};
|
||||
|
||||
};
|
||||
config =
|
||||
let
|
||||
config = let
|
||||
setup = helpers.toLuaObject {
|
||||
inherit (cfg) show_jumps min_jump;
|
||||
ignore_filetypes = attrsets.listToAttrs
|
||||
ignore_filetypes =
|
||||
attrsets.listToAttrs
|
||||
(lib.lists.map (x: attrsets.nameValuePair x true)
|
||||
cfg.ignored_filetypes);
|
||||
ignore_buftypes = attrsets.listToAttrs
|
||||
ignore_buftypes =
|
||||
attrsets.listToAttrs
|
||||
(lib.lists.map (x: attrsets.nameValuePair x true)
|
||||
cfg.ignored_buffertypes);
|
||||
popup = {
|
||||
inherit (cfg) blend width;
|
||||
winhl = if (!isNull cfg.color) then "SpecsPopColor" else "PMenu";
|
||||
winhl =
|
||||
if (!isNull cfg.color)
|
||||
then "SpecsPopColor"
|
||||
else "PMenu";
|
||||
delay_ms = cfg.delay;
|
||||
inc_ms = cfg.increment;
|
||||
fader = helpers.mkRaw (if cfg.fader.builtin == null then
|
||||
cfg.fader.custom
|
||||
else
|
||||
''require("specs").${cfg.fader.builtin}'');
|
||||
resizer = helpers.mkRaw (if cfg.resizer.builtin == null then
|
||||
cfg.resizer.custom
|
||||
else
|
||||
''require("specs").${cfg.resizer.builtin}'');
|
||||
fader = helpers.mkRaw (
|
||||
if cfg.fader.builtin == null
|
||||
then cfg.fader.custom
|
||||
else ''require("specs").${cfg.fader.builtin}''
|
||||
);
|
||||
resizer = helpers.mkRaw (
|
||||
if cfg.resizer.builtin == null
|
||||
then cfg.resizer.custom
|
||||
else ''require("specs").${cfg.resizer.builtin}''
|
||||
);
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
{ pkgs, lib, ... }@args:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in with lib; with helpers;
|
||||
in
|
||||
with lib;
|
||||
with helpers;
|
||||
mkPlugin args {
|
||||
name = "startify";
|
||||
description = "Enable startify";
|
||||
|
@ -17,7 +22,8 @@ mkPlugin args {
|
|||
lists = mkDefaultOpt {
|
||||
description = "Startify display lists. If it's a string, it'll be interpreted as literal lua code";
|
||||
global = "startify_lists";
|
||||
type = types.listOf (types.oneOf [(types.submodule {
|
||||
type = types.listOf (types.oneOf [
|
||||
(types.submodule {
|
||||
options = {
|
||||
type = mkOption {
|
||||
type = types.str;
|
||||
|
@ -35,11 +41,18 @@ mkPlugin args {
|
|||
default = null;
|
||||
};
|
||||
};
|
||||
}) types.str]);
|
||||
})
|
||||
types.str
|
||||
]);
|
||||
|
||||
value = val: let
|
||||
list = map (v: if builtins.isAttrs v then toLuaObject v else v) val;
|
||||
in "{" + (concatStringsSep "," list) + "}";
|
||||
list = map (v:
|
||||
if builtins.isAttrs v
|
||||
then toLuaObject v
|
||||
else v)
|
||||
val;
|
||||
in
|
||||
"{" + (concatStringsSep "," list) + "}";
|
||||
};
|
||||
|
||||
bookmarks = mkDefaultOpt {
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in with helpers; with lib;
|
||||
in
|
||||
with helpers;
|
||||
with lib;
|
||||
mkPlugin attrs {
|
||||
name = "surround";
|
||||
description = "Enable surround.vim";
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.plugins.undotree;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
plugins.undotree = {
|
||||
enable = mkEnableOption "Enable undotree";
|
||||
|
|
|
@ -14,16 +14,24 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs-stable";
|
||||
};
|
||||
|
||||
outputs = { self, nixvim, nixvim-stable, nixpkgs, flake-utils, nixpkgs-stable, build-ts, gleam, ... }:
|
||||
outputs = {
|
||||
self,
|
||||
nixvim,
|
||||
nixvim-stable,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
nixpkgs-stable,
|
||||
build-ts,
|
||||
gleam,
|
||||
...
|
||||
}:
|
||||
(flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
(system: let
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
pkgs-stable = import nixpkgs-stable {inherit system;};
|
||||
build = nixvim.legacyPackages.${system}.makeNixvim;
|
||||
build-stable = nixvim-stable.legacyPackages.${system}.makeNixvim;
|
||||
in
|
||||
rec {
|
||||
in rec {
|
||||
# A plain nixvim configuration
|
||||
packages = {
|
||||
plain = build {};
|
||||
|
@ -118,7 +126,6 @@
|
|||
rnix-lsp.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
options = {
|
||||
|
@ -206,7 +213,6 @@
|
|||
{name = "path";}
|
||||
{name = "buffer";}
|
||||
];
|
||||
|
||||
};
|
||||
barbar.enable = true;
|
||||
};
|
||||
|
@ -275,7 +281,8 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
})) // {
|
||||
}))
|
||||
// {
|
||||
nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
|
@ -288,8 +295,7 @@
|
|||
};
|
||||
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules =
|
||||
[
|
||||
modules = [
|
||||
({pkgs, ...}: {
|
||||
boot.isContainer = true;
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
||||
in
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
||||
in {
|
||||
helpers = mkOption {
|
||||
type = mkOptionType {
|
||||
name = "helpers";
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
modules:
|
||||
{ pkgs, config, lib, ... }@args:
|
||||
|
||||
let
|
||||
modules: {
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
|
||||
shared = import ./_shared.nix args;
|
||||
cfg = config.programs.nixvim;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
programs.nixvim = mkOption {
|
||||
type = types.submodule ((modules pkgs) ++ [{
|
||||
type = types.submodule ((modules pkgs)
|
||||
++ [
|
||||
{
|
||||
options.enable = mkEnableOption "nixvim";
|
||||
config.wrapRc = mkForce true;
|
||||
}]);
|
||||
}
|
||||
]);
|
||||
};
|
||||
nixvim.helpers = shared.helpers;
|
||||
};
|
||||
|
|
|
@ -1,30 +1,35 @@
|
|||
modules:
|
||||
{ pkgs, config, lib, ... }@args:
|
||||
|
||||
let
|
||||
modules: {
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
||||
shared = import ./_shared.nix args;
|
||||
cfg = config.programs.nixvim;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
programs.nixvim = mkOption {
|
||||
type = types.submodule ((modules pkgs) ++ [{
|
||||
type = types.submodule ((modules pkgs)
|
||||
++ [
|
||||
{
|
||||
options.enable = mkEnableOption "nixvim";
|
||||
}]);
|
||||
}
|
||||
]);
|
||||
};
|
||||
nixvim.helpers = shared.helpers;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable
|
||||
config =
|
||||
mkIf cfg.enable
|
||||
(mkMerge [
|
||||
{home.packages = [cfg.finalPackage];}
|
||||
(mkIf (!cfg.wrapRc) {
|
||||
xdg.configFile."nvim/init.lua".text = cfg.initContent;
|
||||
})
|
||||
({
|
||||
{
|
||||
warnings = cfg.warnings;
|
||||
assertions = cfg.assertions;
|
||||
})
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,31 +1,36 @@
|
|||
modules:
|
||||
{ pkgs, config, lib, ... }@args:
|
||||
|
||||
let
|
||||
modules: {
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
||||
shared = import ./_shared.nix args;
|
||||
cfg = config.programs.nixvim;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
programs.nixvim = mkOption {
|
||||
type = types.submodule ((modules pkgs) ++ [{
|
||||
type = types.submodule ((modules pkgs)
|
||||
++ [
|
||||
{
|
||||
options.enable = mkEnableOption "nixvim";
|
||||
}]);
|
||||
}
|
||||
]);
|
||||
};
|
||||
nixvim.helpers = shared.helpers;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable
|
||||
config =
|
||||
mkIf cfg.enable
|
||||
(mkMerge [
|
||||
{environment.systemPackages = [cfg.finalPackage];}
|
||||
(mkIf (!cfg.wrapRc) {
|
||||
environment.etc."nvim/sysinit.lua".text = cfg.initContent;
|
||||
environment.variables."VIM" = "/etc/nvim";
|
||||
})
|
||||
({
|
||||
{
|
||||
warnings = cfg.warnings;
|
||||
assertions = cfg.assertions;
|
||||
})
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
default_pkgs: modules: {pkgs ? default_pkgs, module}:
|
||||
|
||||
let
|
||||
|
||||
default_pkgs: modules: {
|
||||
pkgs ? default_pkgs,
|
||||
module,
|
||||
}: let
|
||||
inherit (pkgs) lib;
|
||||
|
||||
wrap = {wrapRc = true;};
|
||||
|
@ -9,5 +9,5 @@ let
|
|||
eval = lib.evalModules {
|
||||
modules = (modules pkgs) ++ [module wrap];
|
||||
};
|
||||
|
||||
in eval.config.finalPackage
|
||||
in
|
||||
eval.config.finalPackage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue