neovim first init

This commit is contained in:
Noah Masur 2025-02-04 21:57:59 -05:00
parent 8819bb9b9b
commit bb1a36330b
No known key found for this signature in database
27 changed files with 107 additions and 18 deletions

View File

@ -1,7 +1,18 @@
_final: prev: _final: prev:
let
lib = prev.lib;
packages = lib.pipe [
(lib.filesystem.listFilesRecursive ../pkgs)
(builtins.filter (name: (lib.hasSuffix "package.nix" name)))
(builtins.map (package: prev.callPackage package))
];
in
{ {
loadkey = prev.callPackage ../pkgs/tools/misc/loadkey.nix;
aws-ec2 = prev.callPackage ../pkgs/tools/misc/aws-ec2/; loadkey = prev.callPackage ../pkgs/tools/misc/loadkey.nix { };
docker-cleanup = prev.callPackage ../pkgs/tools/misc/docker-cleanup/; aws-ec2 = prev.callPackage ../pkgs/tools/misc/aws-ec2 { };
docker-cleanup = prev.callPackage ../pkgs/tools/misc/docker-cleanup { };
nmasur-neovim = prev.callPackage ../pkgs/applications/editors/neovim/nmasur/neovim { };
} }

View File

@ -13,7 +13,7 @@
description = "Attrset of base16 colorscheme key value pairs."; description = "Attrset of base16 colorscheme key value pairs.";
}; };
config = { config = lib.mkIf config.colors {
plugins = [ pkgs.vimPlugins.base16-nvim ]; plugins = [ pkgs.vimPlugins.base16-nvim ];
setup.base16-colorscheme = config.colors; setup.base16-colorscheme = config.colors;

View File

@ -28,7 +28,7 @@
{ {
pkgs, pkgs,
colors, colors ? null,
terraform ? false, terraform ? false,
github ? false, github ? false,
kubernetes ? false, kubernetes ? false,
@ -46,17 +46,17 @@ pkgs.neovimBuilder {
kubernetes kubernetes
; ;
imports = [ imports = [
../config/align.nix ./config/align.nix
../config/bufferline.nix ./config/bufferline.nix
../config/colors.nix ./config/colors.nix
../config/completion.nix ./config/completion.nix
../config/gitsigns.nix ./config/gitsigns.nix
../config/lsp.nix ./config/lsp.nix
../config/misc.nix ./config/misc.nix
../config/statusline.nix ./config/statusline.nix
../config/syntax.nix ./config/syntax.nix
../config/telescope.nix ./config/telescope.nix
../config/toggleterm.nix ./config/toggleterm.nix
../config/tree.nix ./config/tree.nix
]; ];
} }

View File

@ -194,7 +194,7 @@ in
}; };
}; };
xdg.desktopEntries.aerc = lib.mkIf (pkgs.stdenv.isLinux && config.gui.enable) { xdg.desktopEntries.aerc = lib.mkIf (pkgs.stdenv.isLinux) {
name = "aerc"; name = "aerc";
exec = "${config.terminalLaunchCommand} aerc %u"; exec = "${config.terminalLaunchCommand} aerc %u";
}; };

View File

@ -0,0 +1,78 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.nmasur.presets.programs.neovim;
in
{
options.nmasur.presets.programs.neovim = {
enable = lib.mkEnableOption "Neovim text editor";
package = lib.mkPackageOption pkgs "neovim" { };
colors = lib.mkOption {
type = lib.types.attrs;
description = "Base16 color scheme.";
default = config.theme.colors;
};
github.enable = lib.mkEnableOption "GitHub integration";
terraform.enable = lib.mkEnableOption "Terraform integration";
kubernetes.enable = lib.mkEnableOption "Kubernetes integration";
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
cfg.package = lib.mkDefault pkgs.nmasur-neovim.override {
colors = cfg.colors;
github = cfg.github.enable;
terraform = cfg.terraform.enable;
kubernetes = cfg.kubernetes.enable;
};
# Use Neovim as the editor for git commit messages
programs.git.extraConfig.core.editor = "${lib.getExe cfg.package}";
programs.jujutsu.settings.ui.editor = "${lib.getExe cfg.package}";
# Set Neovim as the default app for text editing and manual pages
home.sessionVariables = {
EDITOR = "${lib.getExe cfg.package}";
MANPAGER = "${lib.getExe cfg.package} +Man!";
};
# Create quick aliases for launching Neovim
programs.fish = {
shellAliases = {
vim = "${lib.getExe cfg.package}";
nvim = "${lib.getExe cfg.package}";
};
shellAbbrs = {
v = lib.mkForce "nvim";
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
vll = "nvim -c 'Telescope oldfiles'";
};
};
# Create a desktop option for launching Neovim from a file manager
# (Requires launching the terminal and then executing Neovim)
xdg.desktopEntries.nvim = lib.mkIf (pkgs.stdenv.isLinux) {
name = "Neovim wrapper";
exec = "${lib.getExe config.nmasur.presets.services.i3.terminal} nvim %F"; # TODO: change to generic
mimeType = [
"text/plain"
"text/markdown"
];
};
xdg.mimeApps.defaultApplications = {
"text/plain" = [ "nvim.desktop" ];
"text/markdown" = [ "nvim.desktop" ];
};
};
}