[fix] nvim: I broke it again ma #11

Merged
jalil merged 1 commit from fix-nvim into main 2024-06-23 15:53:32 +02:00
8 changed files with 561 additions and 576 deletions

View file

@ -93,7 +93,7 @@
system:
f {
inherit system;
pkgs = import nixpkgs {inherit system;};
pkgs = nixpkgs.legacyPackages.${system};
}
);
overlays = builtins.attrValues self.overlays;
@ -110,7 +110,7 @@
in {
nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule {
pkgs = import nixpkgs {inherit system overlays;};
module = ./nvim/nixvim.nix;
module = ./nvim/standalone.nix;
};
fmt = pkgs.callPackage ./fmt.nix {inherit src;};
lint = pkgs.callPackage ./lint.nix {inherit src;};
@ -133,7 +133,7 @@
# Nvim standalone module
nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule {
pkgs = import nixpkgs {inherit system overlays;};
module = ./nvim/nixvim.nix;
module = ./nvim/standalone.nix;
};
}
);
@ -204,9 +204,8 @@
nixvim.homeManagerModules.nixvim
./nvim
];
overlays = builtins.attrValues self.overlays;
homeManagerModuleSandalone = import ./home {inherit overlays nvim-config stylix;};
homeManagerModuleNixOS = import ./home {inherit overlays nvim-config;};
homeManagerModuleSandalone = import ./home {inherit nvim-config stylix;};
homeManagerModuleNixOS = import ./home {inherit nvim-config;};
nixosModule = {
imports =
[

View file

@ -1,5 +1,4 @@
{
overlays,
nvim-config,
stylix ? null,
}: {
@ -13,8 +12,6 @@
in {
imports =
[
# Apply overlays
{nixpkgs = {inherit overlays;};}
nvim-config
./options.nix
./gui

View file

@ -1,6 +1,7 @@
{helpers, ...}: let
inherit (helpers) mkRaw;
in {
config = {
autoGroups = {
"highlightOnYank" = {};
"lspConfig" = {};
@ -84,4 +85,5 @@ in {
'';
}
];
};
}

View file

@ -1,14 +1,17 @@
{
lib,
pkgs,
config,
helpers,
...
}: let
# Force inputs to be included
nixvim = import ./nixvim.nix {inherit lib pkgs config helpers;};
cfg = config.jhome.nvim;
in {
imports = [./options.nix];
config.programs.nixvim = nixvim.config;
config.programs.nixvim = lib.mkMerge [
./standalone.nix
(lib.mkIf cfg.enable {
enable = true;
defaultEditor = lib.mkDefault true;
})
];
}

View file

@ -1,6 +1,7 @@
{helpers, ...}: let
inherit (helpers) mkRaw;
in [
in {
config.keymaps = [
# Quickfix
{
mode = "n";
@ -145,4 +146,5 @@ in [
action = mkRaw "require('nvim-silicon').clip";
options.desc = "Snap Code (to clipboard)";
}
]
];
}

View file

@ -1,112 +0,0 @@
{
pkgs,
lib,
config,
...
} @ args: let
cfg = config.jhome.nvim;
hmAvailable = args ? hmConfig;
nixosAvailable = args ? nixosConfig;
darwinAvailable = args ? darwinConfig;
canSetAsDefault = hmAvailable || nixosAvailable;
notStandalone = hmAvailable || nixosAvailable || darwinAvailable;
augroups = import ./augroups.nix args;
in {
imports = [./options.nix];
config = lib.mkMerge [
(lib.optionalAttrs canSetAsDefault {defaultEditor = lib.mkDefault true;})
(lib.optionalAttrs notStandalone {enable = lib.mkDefault true;})
(lib.mkIf cfg.enable {
package = pkgs.unstable.neovim-unwrapped;
inherit (augroups) autoGroups autoCmd;
plugins = import ./plugins.nix args;
keymaps = import ./mappings.nix args;
globals.mapleader = " ";
# Appearance
colorschemes.gruvbox = {
enable = true;
settings = {
bold = true;
transparent_mode = true;
terminal_colors = true;
};
};
clipboard.providers.wl-copy.enable = true;
opts = {
number = true;
relativenumber = true;
colorcolumn = "+1";
cursorline = true;
wrap = false;
splitright = true;
# Tabs & indentation
smarttab = true;
autoindent = true;
smartindent = true;
# Search path
path = ".,/usr/include,**";
wildmenu = true;
hlsearch = true;
incsearch = true;
ignorecase = true; # Search ignores cases
smartcase = true; # Unless it has a capital letter
# Enable local configuration :h 'exrc'
exrc = true; # safe since nvim 0.9
};
extraPlugins = let
plugins = pkgs.unstable.vimPlugins;
extraPlugins = import ./extraPlugins {pkgs = pkgs.unstable;};
in [
plugins.nui-nvim
plugins.nvim-web-devicons
extraPlugins.vim-jjdescription
extraPlugins.nvim-silicon
];
# Formatting & linters
extraPackages = [
pkgs.unstable.silicon
pkgs.unstable.alejandra
pkgs.unstable.luajitPackages.jsregexp
pkgs.unstable.statix
pkgs.unstable.stylua
pkgs.unstable.shfmt
pkgs.unstable.taplo
pkgs.unstable.typos
pkgs.unstable.yamlfmt
];
extraConfigLuaPre = ''
-- Lua Pre Config
if vim.fn.has 'termguicolors' then
-- Enable RGB colors
vim.g.termguicolors = true
end
-- Useful function
local has_words_before = function()
-- unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil
end
-- END: Lua Pre Config
'';
extraConfigLua = ''
-- Lua Config
require("nvim-silicon").setup {
theme = "gruvbox-dark",
pad_horiz = 16,
pad_vert = 16,
-- Current buffer name
window_title = function()
return vim.fn.fnamemodify(
vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()),
":t"
)
end,
}
-- END: Lua Config
'';
})
];
}

View file

@ -6,6 +6,7 @@
}: let
inherit (helpers) mkRaw;
in {
config.plugins = {
bacon = {
enable = true;
settings.quickfix.enabled = true;
@ -239,4 +240,5 @@ in {
enable = true;
settings.auto_close = true;
};
};
}

92
nvim/standalone.nix Normal file
View file

@ -0,0 +1,92 @@
{pkgs, ...}: {
imports = [./options.nix ./plugins.nix ./mappings.nix ./augroups.nix];
config = {
package = pkgs.unstable.neovim-unwrapped;
globals.mapleader = " ";
# Appearance
colorschemes.gruvbox = {
enable = true;
settings = {
bold = true;
transparent_mode = true;
terminal_colors = true;
};
};
clipboard.providers.wl-copy.enable = true;
opts = {
number = true;
relativenumber = true;
colorcolumn = "+1";
cursorline = true;
wrap = false;
splitright = true;
# Tabs & indentation
smarttab = true;
autoindent = true;
smartindent = true;
# Search path
path = ".,/usr/include,**";
wildmenu = true;
hlsearch = true;
incsearch = true;
ignorecase = true; # Search ignores cases
smartcase = true; # Unless it has a capital letter
# Enable local configuration :h 'exrc'
exrc = true; # safe since nvim 0.9
};
extraPlugins = let
plugins = pkgs.unstable.vimPlugins;
extraPlugins = import ./extraPlugins {pkgs = pkgs.unstable;};
in [
plugins.nui-nvim
plugins.nvim-web-devicons
extraPlugins.vim-jjdescription
extraPlugins.nvim-silicon
];
# Formatting & linters
extraPackages = [
pkgs.unstable.silicon
pkgs.unstable.alejandra
pkgs.unstable.luajitPackages.jsregexp
pkgs.unstable.statix
pkgs.unstable.stylua
pkgs.unstable.shfmt
pkgs.unstable.taplo
pkgs.unstable.typos
pkgs.unstable.yamlfmt
];
extraConfigLuaPre = ''
-- Lua Pre Config
if vim.fn.has 'termguicolors' then
-- Enable RGB colors
vim.g.termguicolors = true
end
-- Useful function
local has_words_before = function()
-- unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil
end
-- END: Lua Pre Config
'';
extraConfigLua = ''
-- Lua Config
require("nvim-silicon").setup {
theme = "gruvbox-dark",
pad_horiz = 16,
pad_vert = 16,
-- Current buffer name
window_title = function()
return vim.fn.fnamemodify(
vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()),
":t"
)
end,
}
-- END: Lua Config
'';
};
}