mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
feat: use nixvim for manpager definition
This commit is contained in:
parent
cc04e10405
commit
c037780743
8 changed files with 78 additions and 141 deletions
|
@ -8,6 +8,14 @@
|
||||||
kanidm-secret-manipulator = prev.callPackage ./kanidm-secret-manipulator.nix {};
|
kanidm-secret-manipulator = prev.callPackage ./kanidm-secret-manipulator.nix {};
|
||||||
segoe-ui-ttf = prev.callPackage ./segoe-ui-ttf.nix {};
|
segoe-ui-ttf = prev.callPackage ./segoe-ui-ttf.nix {};
|
||||||
zsh-histdb-skim = prev.callPackage ./zsh-skim-histdb.nix {};
|
zsh-histdb-skim = prev.callPackage ./zsh-skim-histdb.nix {};
|
||||||
|
neovim-clean = prev.neovim-unwrapped.overrideAttrs (_neovimFinal: neovimPrev: {
|
||||||
|
nativeBuildInputs = (neovimPrev.nativeBuildInputs or []) ++ [prev.makeWrapper];
|
||||||
|
postInstall =
|
||||||
|
(neovimPrev.postInstall or "")
|
||||||
|
+ ''
|
||||||
|
wrapProgram $out/bin/nvim --add-flags "--clean"
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
kanidm = prev.kanidm.overrideAttrs (_finalAttrs: _previousAttrs: {
|
kanidm = prev.kanidm.overrideAttrs (_finalAttrs: _previousAttrs: {
|
||||||
patches = [
|
patches = [
|
||||||
|
|
65
users/modules/config/manpager.nix
Normal file
65
users/modules/config/manpager.nix
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
home.sessionVariables.MANPAGER = lib.getExe (pkgs.nixvim.makeNixvim {
|
||||||
|
package = pkgs.neovim-clean;
|
||||||
|
|
||||||
|
options = {
|
||||||
|
buftype = "nowrite";
|
||||||
|
backup = false;
|
||||||
|
modeline = false;
|
||||||
|
shelltemp = false;
|
||||||
|
swapfile = false;
|
||||||
|
undofile = false;
|
||||||
|
writebackup = false;
|
||||||
|
virtualedit = "all";
|
||||||
|
splitkeep = "screen";
|
||||||
|
termguicolors = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfigLua = ''
|
||||||
|
vim.opt.shadafile = vim.fn.stdpath "state" .. "/shada/man.shada";
|
||||||
|
'';
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
action = "<C-]>";
|
||||||
|
key = "<CR>";
|
||||||
|
mode = ["n"];
|
||||||
|
options = {
|
||||||
|
silent = true;
|
||||||
|
desc = "Jump to tag under cursor";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = ":pop<CR>";
|
||||||
|
key = "<BS>";
|
||||||
|
mode = ["n"];
|
||||||
|
options = {
|
||||||
|
silent = true;
|
||||||
|
desc = "Jump to previous tag in stack";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = ":pop<CR>";
|
||||||
|
key = "<C-Left>";
|
||||||
|
mode = ["n"];
|
||||||
|
options = {
|
||||||
|
silent = true;
|
||||||
|
desc = "Jump to previous tag in stack";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = ":tag<CR>";
|
||||||
|
key = "<C-Right>";
|
||||||
|
mode = ["n"];
|
||||||
|
options = {
|
||||||
|
silent = true;
|
||||||
|
desc = "Jump to next tag in stack";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
{pkgs, ...}: let
|
|
||||||
nvimPager = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped nvimConfig;
|
|
||||||
nvimConfig =
|
|
||||||
pkgs.neovimUtils.makeNeovimConfig {
|
|
||||||
wrapRc = false;
|
|
||||||
withPython3 = false;
|
|
||||||
withRuby = false;
|
|
||||||
}
|
|
||||||
// {
|
|
||||||
wrapperArgs = ["--add-flags" "--clean -u ${./init.lua}"];
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
home.sessionVariables.MANPAGER = "${nvimPager}/bin/nvim '+Man!'";
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
vim.opt.buftype = "nowrite"
|
|
||||||
vim.opt.backup = false
|
|
||||||
vim.opt.modeline = false
|
|
||||||
vim.opt.shelltemp = false
|
|
||||||
vim.opt.swapfile = false
|
|
||||||
vim.opt.undofile = false
|
|
||||||
vim.opt.writebackup = false
|
|
||||||
vim.opt.shadafile = vim.fn.stdpath "state" .. "/shada/man.shada"
|
|
||||||
vim.opt.virtualedit = "all"
|
|
||||||
vim.opt.splitkeep = "screen"
|
|
||||||
-- Make sure to use ANSI colors
|
|
||||||
vim.opt.termguicolors = false
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<CR>", "<C-]>", { silent = true, desc = "Jump to tag under cursor" })
|
|
||||||
vim.keymap.set("n", "<BS>", ":pop<CR>", { silent = true, desc = "Jump to previous tag in stack" })
|
|
||||||
vim.keymap.set("n", "<C-Left>", ":pop<CR>", { silent = true, desc = "Jump to previous tag in stack" })
|
|
||||||
vim.keymap.set("n", "<C-Right>", ":tag<CR>", { silent = true, desc = "Jump to next tag in stack" })
|
|
|
@ -1,6 +1,4 @@
|
||||||
{
|
{
|
||||||
programs.neovim-custom.enable = true;
|
|
||||||
|
|
||||||
home.persistence."/state".directories = [
|
home.persistence."/state".directories = [
|
||||||
".local/share/nvim"
|
".local/share/nvim"
|
||||||
".local/state/nvim"
|
".local/state/nvim"
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
imports = [
|
imports = [
|
||||||
./uid.nix
|
./uid.nix
|
||||||
./secrets.nix
|
./secrets.nix
|
||||||
./neovim.nix
|
|
||||||
|
|
||||||
./config/htop.nix
|
./config/htop.nix
|
||||||
./config/impermanence.nix
|
./config/impermanence.nix
|
||||||
./config/manpager
|
./config/manpager.nix
|
||||||
./config/neovim.nix
|
./config/neovim.nix
|
||||||
./config/shell
|
./config/shell
|
||||||
./config/utils.nix
|
./config/utils.nix
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit
|
|
||||||
(lib)
|
|
||||||
concatMapStrings
|
|
||||||
flip
|
|
||||||
mkEnableOption
|
|
||||||
mkIf
|
|
||||||
mkOption
|
|
||||||
mkPackageOption
|
|
||||||
types
|
|
||||||
;
|
|
||||||
|
|
||||||
cfg = config.programs.neovim-custom;
|
|
||||||
|
|
||||||
initLuaContent = ''
|
|
||||||
${cfg.initEarly}
|
|
||||||
|
|
||||||
-- Begin plugin configuration
|
|
||||||
${concatMapStrings (x: "${x.config}\n") (cfg.config.plugins or [])}
|
|
||||||
-- End plugin configuration
|
|
||||||
|
|
||||||
${cfg.init}
|
|
||||||
'';
|
|
||||||
|
|
||||||
nvimConfig =
|
|
||||||
pkgs.neovimUtils.makeNeovimConfig cfg.config
|
|
||||||
// {
|
|
||||||
wrapRc = false;
|
|
||||||
wrapperArgs = ["--add-flags" "-u ${pkgs.writeText "init.lua" initLuaContent}"];
|
|
||||||
};
|
|
||||||
|
|
||||||
finalPackage =
|
|
||||||
flip pkgs.wrapNeovimUnstable nvimConfig
|
|
||||||
(cfg.package.overrideAttrs (_final: prev: {
|
|
||||||
nativeBuildInputs = (prev.nativeBuildInputs or []) ++ [pkgs.makeWrapper];
|
|
||||||
postInstall =
|
|
||||||
(prev.postInstall or "")
|
|
||||||
+ ''
|
|
||||||
wrapProgram $out/bin/nvim --add-flags "--clean"
|
|
||||||
'';
|
|
||||||
}));
|
|
||||||
in {
|
|
||||||
options.programs.neovim-custom = {
|
|
||||||
enable = mkEnableOption "Neovim";
|
|
||||||
package = mkPackageOption pkgs "neovim-unwrapped" {};
|
|
||||||
config = mkOption {
|
|
||||||
description = "The neovim configuration to use (passed to makeNeovimConfig and then to wrapNeovimUnstable)";
|
|
||||||
default = {};
|
|
||||||
type = types.anything;
|
|
||||||
};
|
|
||||||
initEarly = mkOption {
|
|
||||||
description = "The early init.lua content that will be added before plugin configs.";
|
|
||||||
default = "";
|
|
||||||
type = types.lines;
|
|
||||||
};
|
|
||||||
init = mkOption {
|
|
||||||
description = "The init.lua content, added after plugin configs.";
|
|
||||||
default = "";
|
|
||||||
type = types.lines;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
home = {
|
|
||||||
# XXX: TODO packages = [finalPackage];
|
|
||||||
shellAliases.E = "${finalPackage}/bin/nvim";
|
|
||||||
sessionVariables.EDITOR = "nvim";
|
|
||||||
shellAliases.vimdiff = "nvim -d";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -3,37 +3,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
#programs.neovim-custom = {
|
|
||||||
# config = {
|
|
||||||
# withPython3 = false;
|
|
||||||
# withRuby = false;
|
|
||||||
# withNodeJs = false;
|
|
||||||
# #extraPython3Packages = p: [];
|
|
||||||
# plugins = with pkgs.vimPlugins; [
|
|
||||||
# {
|
|
||||||
# plugin = neo-tree-nvim;
|
|
||||||
# config =
|
|
||||||
# /*
|
|
||||||
# lua
|
|
||||||
# */
|
|
||||||
# ''
|
|
||||||
# require("neo-tree").setup {}
|
|
||||||
# '';
|
|
||||||
# }
|
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
# init = builtins.readFile ./aaa/init.lua;
|
|
||||||
#};
|
|
||||||
|
|
||||||
home.shellAliases.nixvim = lib.getExe (pkgs.nixvim.makeNixvim {
|
home.shellAliases.nixvim = lib.getExe (pkgs.nixvim.makeNixvim {
|
||||||
package = pkgs.neovim-unwrapped.overrideAttrs (_final: prev: {
|
package = pkgs.neovim-clean;
|
||||||
nativeBuildInputs = (prev.nativeBuildInputs or []) ++ [pkgs.makeWrapper];
|
|
||||||
postInstall =
|
|
||||||
(prev.postInstall or "")
|
|
||||||
+ ''
|
|
||||||
wrapProgram $out/bin/nvim --add-flags "--clean"
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
|
|
||||||
colorschemes = {
|
colorschemes = {
|
||||||
catppuccin = {
|
catppuccin = {
|
||||||
|
@ -158,6 +129,9 @@
|
||||||
};
|
};
|
||||||
in [(pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped nvimConfig)];
|
in [(pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped nvimConfig)];
|
||||||
|
|
||||||
|
home.sessionVariables.EDITOR = "nvim";
|
||||||
|
home.shellAliases.vimdiff = "nvim -d";
|
||||||
|
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
"nvim/ftplugin".source = ./ftplugin;
|
"nvim/ftplugin".source = ./ftplugin;
|
||||||
"nvim/init.lua".source = ./init.lua;
|
"nvim/init.lua".source = ./init.lua;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue