Merge remote-tracking branch 'refs/remotes/origin/nixos' into nixos

This commit is contained in:
Moritz Böhme 2023-09-19 09:51:20 +02:00
commit b916e4ac4d
36 changed files with 339 additions and 503 deletions

View file

@ -71,27 +71,6 @@
"type": "github" "type": "github"
} }
}, },
"codeium-nvim": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1693966170,
"narHash": "sha256-maRkkUCzjSXK04ts+Io0WFBV1MxR7dCw8I6TV03Dpbs=",
"owner": "jcdickinson",
"repo": "codeium.nvim",
"rev": "6a8cbce54c41e0c305b5f77721f61b2ddd4b6c6d",
"type": "github"
},
"original": {
"owner": "jcdickinson",
"repo": "codeium.nvim",
"type": "github"
}
},
"darwin": { "darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -224,21 +203,6 @@
} }
}, },
"flake-utils": { "flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
@ -256,7 +220,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems_3" "systems": "systems_3"
}, },
@ -274,7 +238,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_4": { "flake-utils_3": {
"inputs": { "inputs": {
"systems": "systems_4" "systems": "systems_4"
}, },
@ -566,7 +530,7 @@
}, },
"neovim-flake": { "neovim-flake": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_2",
"nixpkgs": [ "nixpkgs": [
"neovim-nightly-overlay", "neovim-nightly-overlay",
"nixpkgs" "nixpkgs"
@ -634,6 +598,21 @@
"type": "github" "type": "github"
} }
}, },
"nix-lazy-nvim": {
"locked": {
"lastModified": 1694868321,
"narHash": "sha256-LHPQkD+7ltdo77gpFQOnr8QAgYPdtFf9pm/Alwrs570=",
"ref": "refs/heads/main",
"rev": "1dc6361600111b1c46f6e85221334c8c47f88200",
"revCount": 4,
"type": "git",
"url": "https://git.moritzboeh.me/moritz/NixLazy.nvim"
},
"original": {
"type": "git",
"url": "https://git.moritzboeh.me/moritz/NixLazy.nvim"
}
},
"nix-super": { "nix-super": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
@ -855,7 +834,7 @@
"pre-commit-hooks": { "pre-commit-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_3",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": "nixpkgs_7", "nixpkgs": "nixpkgs_7",
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
@ -897,8 +876,7 @@
"agenix": "agenix", "agenix": "agenix",
"arkenfox-userjs": "arkenfox-userjs", "arkenfox-userjs": "arkenfox-userjs",
"asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver",
"codeium-nvim": "codeium-nvim", "flake-utils": "flake-utils",
"flake-utils": "flake-utils_2",
"hmts-nvim": "hmts-nvim", "hmts-nvim": "hmts-nvim",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"hypr-contrib": "hypr-contrib", "hypr-contrib": "hypr-contrib",
@ -907,6 +885,7 @@
"master": "master", "master": "master",
"neovim-nightly-overlay": "neovim-nightly-overlay", "neovim-nightly-overlay": "neovim-nightly-overlay",
"nil": "nil", "nil": "nil",
"nix-lazy-nvim": "nix-lazy-nvim",
"nix-super": "nix-super", "nix-super": "nix-super",
"nixpkgs": "nixpkgs_6", "nixpkgs": "nixpkgs_6",
"nvim-treesitter": "nvim-treesitter", "nvim-treesitter": "nvim-treesitter",

View file

@ -53,8 +53,7 @@
actions-preview-nvim.flake = false; actions-preview-nvim.flake = false;
actions-preview-nvim.url = "github:aznhe21/actions-preview.nvim"; actions-preview-nvim.url = "github:aznhe21/actions-preview.nvim";
codeium-nvim.url = "github:jcdickinson/codeium.nvim"; nix-lazy-nvim.url = "git+https://git.moritzboeh.me/moritz/NixLazy.nvim";
codeium-nvim.inputs.nixpkgs.follows = "nixpkgs";
# Hyprland # Hyprland
hypr-contrib.url = "github:hyprwm/contrib"; hypr-contrib.url = "github:hyprwm/contrib";
@ -95,7 +94,6 @@
overlays = [ overlays = [
inputs.hypr-contrib.overlays.default inputs.hypr-contrib.overlays.default
inputs.hyprland.overlays.default
inputs.neovim-nightly-overlay.overlay inputs.neovim-nightly-overlay.overlay
overlay overlay
]; ];
@ -128,6 +126,7 @@
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { inherit inputs self; }; extraSpecialArgs = { inherit inputs self; };
sharedModules = [ inputs.nix-lazy-nvim.homeManagerModules.default ];
}; };
} }
inputs.agenix.nixosModules.age inputs.agenix.nixosModules.age

View file

@ -34,17 +34,29 @@ let
which-nix = pkgs.writeFishApplication { which-nix = pkgs.writeFishApplication {
name = "which-nix"; name = "which-nix";
runtimeInputs = with pkgs; [ which coreutils-full ]; runtimeInputs = with pkgs; [ which coreutils-full procps ];
text = /* fish */ '' text = /* fish */ ''
readlink -f (which $argv) function recurse -a path;
if not test -f "$path"
return
end
echo $path
if test -L $path
recurse (readlink $path)
end
end
for arg in $argv
recurse (which $arg)
end
''; '';
completions = /* fish */ '' completions = /* fish */ ''
complete -c which-nix -fa '(__fish_complete_command)' complete -c which-nix -fa '(__fish_complete_command)'
''; '';
}; };
gi = pkgs.writeFishApplication gi = pkgs.writeFishApplication {
{
name = "gi"; name = "gi";
runtimeInputs = with pkgs; [ fzf gum curl ]; runtimeInputs = with pkgs; [ fzf gum curl ];
text = /* fish */ '' text = /* fish */ ''
@ -149,6 +161,7 @@ in
# nix # nix
(nom-system-command "nixos-boot" "sudo nixos-rebuild boot --flake ~/.dotfiles") (nom-system-command "nixos-boot" "sudo nixos-rebuild boot --flake ~/.dotfiles")
(nom-system-command "nixos-switch" "sudo nixos-rebuild switch --flake ~/.dotfiles") (nom-system-command "nixos-switch" "sudo nixos-rebuild switch --flake ~/.dotfiles")
(nom-system-command "nixos-test" "sudo nixos-rebuild test --flake ~/.dotfiles")
manix manix
nix-index nix-index
nix-output-monitor nix-output-monitor

View file

@ -8,9 +8,12 @@ with lib;
let let
cfg = config.my.programs.fish; cfg = config.my.programs.fish;
shellConfig = config.my.shell; shellConfig = config.my.shell;
exportedVariables =
let
exportVariables = exportVariables =
lib.mapAttrsToList (n: v: ''set -x ${n} "${v}"'') shellConfig.variables; lib.mapAttrsToList (n: v: ''set -x ${n} "${v}"'') shellConfig.variables;
exportedVariables = lib.concatStringsSep "\n" exportVariables; in
lib.concatStringsSep "\n" exportVariables;
in in
{ {
options.my.programs.fish.enable = mkEnableOption "fish"; options.my.programs.fish.enable = mkEnableOption "fish";

View file

@ -9,7 +9,8 @@ with lib;
let let
cfg = config.my.programs.hyprland; cfg = config.my.programs.hyprland;
hyprland = pkgs.hyprland.override { enableNvidiaPatches = cfg.nvidiaSupport; }; hyprland-nvidia = pkgs.hyprland.override { enableNvidiaPatches = true; };
hyprland = if cfg.nvidiaSupport then hyprland-nvidia else pkgs.hyprland;
in in
{ {
options.my.programs.hyprland = { options.my.programs.hyprland = {

View file

@ -1,190 +1,13 @@
{ config { config, lib, pkgs, ... }:
, lib
, pkgs
, ...
}:
with lib; with lib;
let let
cfg = config.my.programs.nvim; cfg = config.my.programs.nvim;
boolToString = bool: if bool then "true" else "false";
quote = str: ''"${toString str}"'';
id = x: x;
listToString = sep: f: list: ''{ ${concatStringsSep sep (map f list)} }'';
listToStringOneLine = listToString ", ";
listToStringMultiLine' = listToString ",\n" id;
keybinding = { key, cmd, func, mode, desc }:
let
cmdString =
if cmd != null
then quote cmd
else
(
if func != null
then func
else abort "Either cmd or function must be set"
);
descString = optionalString (desc != null) "desc = ${quote desc},";
in
''{ ${quote key}, ${cmdString}, mode = ${listToStringOneLine quote mode}, ${descString} }'';
lazySpecFromPlugin =
{ plugin, dependencies, init, conf, lazy, event, enabled, cmd, ft, priority, keys }:
listToStringMultiLine'
([
"dir = ${quote plugin}"
"name = ${quote (getName plugin)}"
]
++ (optional (lazy != null) "lazy = ${boolToString lazy}")
++ (optional (!enabled) "enabled = ${boolToString enabled}")
++ (optional (dependencies != [ ]) "dependencies = ${listToStringMultiLine' (map lazySpecFromPlugin dependencies)}")
++ (optional (init != null) "init = function(plugin)\n${toString init}\nend")
++ (optional (conf != null) "config = function(plugin, opts)\n${toString conf}\nend")
++ (optional (keys != [ ]) "keys = ${listToStringMultiLine' (map keybinding keys)}")
++ (optional (event != [ ]) "event = ${listToStringOneLine quote event}")
++ (optional (cmd != [ ]) "cmd = ${listToStringOneLine quote cmd}")
++ (optional (ft != [ ]) "ft = ${listToStringOneLine quote ft}")
++ (optional (priority != null) "priority = ${toString priority}")
);
lazySpecs = listToStringMultiLine' (map lazySpecFromPlugin cfg.plugins);
lazy = /* lua */ ''
require("lazy").setup(${lazySpecs})
'';
in in
{ {
imports = [ ./plugins ]; imports = lib.my.listModulesRec ./plugins;
options.my.programs.nvim = {
enable = mkEnableOption "nvim";
plugins = mkOption {
default = [ ];
description = ''
List of plugins with config.
'';
type = with types; listOf (
let
sub = submodule {
options = {
conf = mkOption {
type = nullOr str;
default = null;
description = ''
Lua function to be executed when the plugin is loaded.
'';
};
dependencies = mkOption {
type = listOf sub;
default = [ ];
description = ''
List of plugins this plugin depends on.
'';
};
init = mkOption {
type = nullOr str;
default = null;
description = ''
Lua code to be executed when the plugin is initialized.
'';
};
event = mkOption {
type = listOf str;
default = [ ];
description = ''
Event to load the plugin on.
'';
};
lazy = mkOption {
type = nullOr bool;
default = null;
description = ''
Whether to load the plugin lazily.
'';
};
plugin = mkOption {
type = package;
description = ''
The plugin package.
'';
};
enabled = mkOption {
type = bool;
default = true;
description = ''
Whether to enable the plugin.
'';
};
cmd = mkOption {
type = listOf str;
default = [ ];
description = ''
Command to load the plugin.
'';
};
ft = mkOption {
type = listOf str;
default = [ ];
description = ''
Filetype to load the plugin on.
'';
};
priority = mkOption {
type = nullOr int;
default = null;
description = ''
Priority to load the plugin.
'';
};
keys = mkOption {
default = [ ];
description = ''
List of keybindings.
'';
type = listOf (submodule {
options = {
key = mkOption {
type = str;
description = ''
Key to bind.
'';
};
cmd = mkOption {
type = nullOr str;
default = null;
description = ''
Command to execute.
'';
};
func = mkOption {
type = nullOr str;
default = null;
description = ''
Function to execute.
'';
};
mode = mkOption {
type = listOf str;
default = [ "n" ];
description = ''
Mode to bind the key in.
'';
};
desc = mkOption {
type = nullOr str;
default = null;
description = ''
Description of the keybinding.
'';
};
};
});
};
};
};
in
sub
);
};
};
options.my.programs.nvim.enable = mkEnableOption "nvim";
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.moritz = { home-manager.users.moritz = {
@ -195,17 +18,7 @@ in
else neovide else neovide
) )
]; ];
xdg.configFile."nvim/init.lua" = {
source =
let
text = lib.concatLines [ (builtins.readFile ./options.lua) lazy ];
in
pkgs.runCommand "init.lua" { inherit text; } ''
touch $out
echo -n "$text" > $out
${getExe pkgs.stylua} $out
'';
};
programs.neovim = { programs.neovim = {
enable = true; enable = true;
package = pkgs.neovim-nightly; package = pkgs.neovim-nightly;
@ -213,14 +26,6 @@ in
vimdiffAlias = true; vimdiffAlias = true;
withNodeJs = true; withNodeJs = true;
withPython3 = true; withPython3 = true;
extraPython3Packages = ps:
let
plugins = map (getAttr "plugin") cfg.plugins;
depAttrName = "python3Dependencies";
filtered = filter (hasAttr depAttrName) plugins;
funcs = map (getAttr depAttrName) filtered;
in
foldl (list: f: list ++ (f ps)) [ ] funcs;
extraPackages = with pkgs; extraPackages = with pkgs;
[ [
alejandra alejandra
@ -242,9 +47,8 @@ in
typst-lsp typst-lsp
yamlfmt yamlfmt
]; ];
plugins = [ extraLuaConfig = readFile ./options.lua;
pkgs.vimPlugins.lazy-nvim lazy.enable = true;
];
}; };
}; };
}; };

View file

@ -1,30 +1,24 @@
{ lib, pkgs, ... }: { pkgs, lib, ... }:
with builtins; with builtins;
{ {
config.my.programs.nvim.plugins = with pkgs.vimPlugins; [ config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
{
plugin = which-key-nvim;
lazy = false;
conf = readFile ./which-key-nvim.lua;
}
{
plugin = catppuccin-nvim;
conf = readFile ./catppuccin-nvim.lua;
lazy = false;
priority = 99;
}
{ {
plugin = formatter-nvim; plugin = formatter-nvim;
cmd = [ "Format" "Fmt" ];
keys = [ keys = [
{ key = "="; cmd = "<cmd>Format<cr>"; desc = "format (formatter)"; } {
key = "=";
cmd = "<cmd>Format<cr>";
desc = "format (formatter)";
}
]; ];
conf = readFile ./formatter-nvim.lua; conf = readFile ./lua/formatter-nvim.lua;
} }
{ {
plugin = oil-nvim; plugin = oil-nvim;
lazy = false; lazy = false;
conf = readFile ./oil-nvim.lua; opts = { };
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{ plugin = nvim-web-devicons; } { plugin = nvim-web-devicons; }
@ -33,7 +27,7 @@ with builtins;
{ {
plugin = mini-nvim; plugin = mini-nvim;
lazy = false; lazy = false;
conf = readFile ./mini-nvim.lua; conf = readFile ./lua/mini-nvim.lua;
} }
{ {
plugin = trouble-nvim; plugin = trouble-nvim;
@ -44,31 +38,35 @@ with builtins;
{ key = "<leader>xq"; cmd = "<cmd>TroubleToggle quickfix<cr>"; desc = "Quickfix List (Trouble)"; } { key = "<leader>xq"; cmd = "<cmd>TroubleToggle quickfix<cr>"; desc = "Quickfix List (Trouble)"; }
{ key = "<leader>xt"; cmd = "<cmd>TodoTrouble<cr>"; desc = "Todo (Trouble)"; } { key = "<leader>xt"; cmd = "<cmd>TodoTrouble<cr>"; desc = "Todo (Trouble)"; }
{ key = "<leader>xT"; cmd = "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>"; desc = "Todo/Fix/Fixme (Trouble)"; } { key = "<leader>xT"; cmd = "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>"; desc = "Todo/Fix/Fixme (Trouble)"; }
{ key = "<leader>st"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; } { key = "<leader>ft"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; }
{ {
key = "[q"; key = "[q";
func = /* lua */ ''function() func = /* lua */ ''
function()
if require("trouble").is_open() then if require("trouble").is_open() then
require("trouble").previous({ skip_groups = true, jump = true }) require("trouble").previous({ skip_groups = true, jump = true })
else else
vim.cmd.cprev() vim.cmd.cprev()
end end
end''; end
'';
desc = "Previous trouble/quickfix item"; desc = "Previous trouble/quickfix item";
} }
{ {
key = "]q"; key = "]q";
func = /* lua */ ''function() func = /* lua */ ''
function()
if require("trouble").is_open() then if require("trouble").is_open() then
require("trouble").next({ skip_groups = true, jump = true }) require("trouble").next({ skip_groups = true, jump = true })
else else
vim.cmd.cnext() vim.cmd.cnext()
end end
end''; end
'';
desc = "Next trouble/quickfix item"; desc = "Next trouble/quickfix item";
} }
]; ];
conf = readFile ./trouble-nvim.lua; opts = { };
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{ plugin = nvim-web-devicons; } { plugin = nvim-web-devicons; }
@ -76,71 +74,53 @@ with builtins;
} }
{ {
plugin = nvim-cmp; plugin = nvim-cmp;
conf = readFile ./nvim-cmp.lua; conf = readFile ./lua/nvim-cmp.lua;
event = [ "InsertEnter" ]; event = [ "InsertEnter" ];
dependencies = [ dependencies = [
{ {
plugin = nvim-autopairs; plugin = nvim-autopairs;
conf = /* lua */ '' opts = { };
require("nvim-autopairs").setup({})
'';
} }
{ plugin = cmp-async-path; } { plugin = cmp-async-path; }
{ plugin = cmp-buffer; } { plugin = cmp-buffer; }
{ plugin = cmp-cmdline; } { plugin = cmp-cmdline; }
{ plugin = cmp-nvim-lsp; } { plugin = cmp-nvim-lsp; }
{ plugin = cmp_luasnip; } { plugin = cmp_luasnip; }
{
plugin = codeium-nvim;
conf = /* lua */ ''
require("codeium").setup({})
'';
}
{ plugin = friendly-snippets; } { plugin = friendly-snippets; }
{ plugin = lspkind-nvim; } { plugin = lspkind-nvim; }
{ plugin = luasnip; } { plugin = luasnip; }
{
plugin = copilot-cmp;
opts = { };
dependencies = [
{
plugin = copilot-lua;
opts = {
suggestion = { enabled = false; };
panel = { enabled = false; };
};
conf = /* lua */ ''
require("copilot").setup(opts)
vim.cmd("Copilot disable")
'';
}
]; ];
} }
{ ];
plugin = todo-comments-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./todo-comments-nvim.lua;
dependencies = [{ plugin = plenary-nvim; }];
} }
{ {
plugin = direnv-vim; plugin = direnv-vim;
lazy = false; lazy = false;
} }
{
plugin = nvim-treesitter;
event = [ "BufReadPost" "BufNewFile" ];
conf =
let
parserDir = pkgs.symlinkJoin {
name = "tresitter-grammars-all";
paths = lib.attrValues (lib.filterAttrs (_: builtins.isAttrs) nvim-treesitter-parsers);
};
in
readFile ./nvim-treesitter.lua + ''
vim.opt.runtimepath:append("${parserDir}")
require'nvim-treesitter.configs'.setup {
parser_install_dir = "${parserDir}",
}
'';
dependencies = [
{ plugin = nvim-ts-context-commentstring; }
];
}
{ {
plugin = nvim-lspconfig; plugin = nvim-lspconfig;
event = [ "BufRead" "BufNewFile" ]; event = [ "BufRead" "BufNewFile" ];
conf = readFile ./nvim-lspconfig.lua; conf = readFile ./lua/nvim-lspconfig.lua;
dependencies = [ dependencies = [
{ plugin = lsp_signature-nvim; } { plugin = lsp_signature-nvim; }
{ {
plugin = null-ls-nvim; plugin = null-ls-nvim;
conf = readFile ./null-ls-nvim.lua; conf = readFile ./lua/null-ls-nvim.lua;
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{ plugin = plenary-nvim; } { plugin = plenary-nvim; }
@ -150,36 +130,27 @@ with builtins;
{ plugin = lsp_lines-nvim; } { plugin = lsp_lines-nvim; }
{ {
plugin = nvim-ufo; plugin = nvim-ufo;
conf = readFile ./nvim-ufo.lua; conf = readFile ./lua/nvim-ufo.lua;
dependencies = [ dependencies = [
{ plugin = promise-async; } { plugin = promise-async; }
]; ];
} }
{ {
plugin = neodev-nvim; plugin = neodev-nvim;
conf = readFile ./neodev-nvim.lua; conf = readFile ./lua/neodev-nvim.lua;
} }
{ {
plugin = inc-rename-nvim; plugin = inc-rename-nvim;
conf = /* lua */ '' opts = {
require("inc_rename").setup { input_buffer_type = "dressing";
input_buffer_type = "dressing", };
}
'';
dependencies = [ dependencies = [
{ { plugin = dressing-nvim; }
plugin = dressing-nvim;
}
]; ];
} }
{ plugin = actions-preview-nvim; } { plugin = actions-preview-nvim; }
]; ];
} }
{
plugin = statuscol-nvim;
event = [ "VeryLazy" ];
conf = readFile ./statuscol-nvim.lua;
}
{ {
plugin = vim-fugitive; plugin = vim-fugitive;
cmd = [ cmd = [
@ -212,55 +183,35 @@ with builtins;
plugin = vim-tmux-navigator; plugin = vim-tmux-navigator;
event = [ "VeryLazy" ]; event = [ "VeryLazy" ];
} }
{
plugin = gitsigns-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./gitsigns-nvim.lua;
dependencies = [{ plugin = which-key-nvim; }];
}
{ {
plugin = nvim-lastplace; plugin = nvim-lastplace;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-lastplace.lua; opts = {
} lastplace_ignore_buftype = [ "quickfix" "nofile" "help" ];
{ lastplace_ignore_filetype = [ "gitcommit" "gitrebase" "svn" "hgcommit" ];
plugin = nvim-treesitter-textsubjects; lastplace_open_folds = true;
event = [ "BufReadPost" "BufNewFile" ]; };
conf = readFile ./nvim-treesitter-textsubjects.lua;
}
{
plugin = smartcolumn-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./smartcolumn-nvim.lua;
} }
{ {
plugin = telescope-nvim; plugin = telescope-nvim;
cmd = [ "Telescope" ]; cmd = [ "Telescope" ];
conf = builtins.readFile ./telescope.lua; conf = builtins.readFile ./lua/telescope.lua;
keys = [ keys = [
{ key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; } { key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; }
{ key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; } { key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; }
{ key = "<leader>fr"; cmd = "<cmd>Telescope oldfiles<cr>"; desc = "Find recent files"; } { key = "<leader>fl"; cmd = "<cmd>Telescope current_buffer_fuzzy_find<cr>"; desc = "Search lines"; }
{ key = "<leader>sl"; cmd = "<cmd>Telescope current_buffer_fuzzy_find<cr>"; desc = "Search lines"; } { key = "<leader>fg"; cmd = "<cmd>Telescope live_grep<cr>"; desc = "Live grep"; }
{ key = "<leader>sg"; cmd = "<cmd>Telescope live_grep<cr>"; desc = "Live grep"; } { key = "<leader>fh"; cmd = "<cmd>Telescope help_tags<cr>"; desc = "Help tags"; }
{ key = "<leader>sc"; cmd = "<cmd>Telescope command_history<cr>"; desc = "Command history"; }
{ key = "<leader>sC"; cmd = "<cmd>Telescope commands<cr>"; desc = "Commands"; }
{ key = "<leader>sd"; cmd = "<cmd>Telescope diagnostics<cr>"; desc = "Diagnostics"; }
{ key = "<leader>sh"; cmd = "<cmd>Telescope help_tags<cr>"; desc = "Help tags"; }
{ key = "<leader>sk"; cmd = "<cmd>Telescope keymaps<cr>"; desc = "Keymaps"; }
{ key = "<leader>ss"; cmd = "<cmd>Telescope lsp_document_symbols<cr>"; desc = "Symbols (Document)"; }
{ key = "<leader>sS"; cmd = "<cmd>Telescope lsp_workspace_symbols<cr>"; desc = "Symbols (Workspace)"; }
]; ];
dependencies = [ dependencies = [
{ plugin = plenary-nvim; } { plugin = plenary-nvim; }
{ plugin = which-key-nvim; }
{ plugin = telescope-fzf-native-nvim; } { plugin = telescope-fzf-native-nvim; }
]; ];
} }
{ {
plugin = vim-startuptime; plugin = vim-startuptime;
cmd = [ "StartupTime" ]; cmd = [ "StartupTime" ];
conf = readFile ./vim-startuptime.lua; conf = readFile ./lua/vim-startuptime.lua;
} }
{ {
plugin = typst-vim; plugin = typst-vim;
@ -269,47 +220,28 @@ with builtins;
{ {
plugin = comment-nvim; plugin = comment-nvim;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = /* lua */ '' opts = { };
require("Comment").setup()
'';
} }
{ {
plugin = telekasten-nvim; plugin = telekasten-nvim;
dependencies = [ dependencies = [
{ plugin = telescope-nvim; } { plugin = telescope-nvim; }
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{
plugin = markdown-preview-nvim;
ft = [ "md" ];
}
]; ];
cmd = [ "Telekasten" ]; cmd = [ "Telekasten" ];
keys = [ keys = [
{ key = "<leader>z"; cmd = "<cmd>Telekasten<cr>"; desc = "zettelkasten"; } { key = "<leader>z"; cmd = "<cmd>Telekasten<cr>"; desc = "zettelkasten"; }
]; ];
conf = builtins.readFile ./zettelkasten-nvim.lua; conf = builtins.readFile ./lua/zettelkasten-nvim.lua;
}
{
plugin = markdown-preview-nvim;
ft = [ "md" ];
} }
{ {
plugin = nvim-surround; plugin = nvim-surround;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = /* lua */ '' opts = { };
require("nvim-surround").setup({})
'';
}
{
plugin = nvim-treesitter-context;
event = [ "BufReadPost" "BufNewFile" ];
conf = /* lua */ ''
require("treesitter-context").setup({})
'';
}
{
plugin = dressing-nvim;
event = [ "VeryLazy" ];
}
{
plugin = hmts-nvim;
ft = [ "nix" ];
} }
{ {
plugin = zen-mode-nvim; plugin = zen-mode-nvim;
@ -344,5 +276,42 @@ with builtins;
} }
]; ];
} }
{
plugin = refactoring-nvim;
keys = [
{ key = "<leader>re"; cmd = ": Refactor eextract "; desc = "Extract"; mode = [ "x" ]; }
{ key = "<leader>rf"; cmd = ": Refactor extract_to_file "; desc = "Extract to file"; mode = [ "x" ]; }
{ key = "<leader>rv"; cmd = ": Refactor extract_var "; desc = "Extract variable"; mode = [ "x" ]; }
{ key = "<leader>ri"; cmd = ": Refactor inline_var"; desc = "Inline variable"; mode = [ "n" "x" ]; }
{ key = "<leader>rI"; cmd = ": Refactor inline_func"; desc = "Inline function"; mode = [ "n" "x" ]; }
{ key = "<leader>rb"; cmd = ": Refactor extract_block"; desc = "Extract block"; mode = [ "n" ]; }
{ key = "<leader>rbf"; cmd = ": Refactor extract_block_to_file"; desc = "Extract block to file"; mode = [ "n" ]; }
];
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = plenary-nvim; }
{ plugin = nvim-lspconfig; }
];
init = /* lua */ ''
require("which-key").register({
["<leader>r"] = {
name = "refactoring",
},
})
'';
opts = { };
}
{
plugin = harpoon;
keys = [
{ key = "<leader>ha"; cmd = "<cmd>lua require('harpoon.mark').add_file()<cr>"; desc = "Add file"; }
{ key = "<leader>hh"; cmd = "<cmd>lua require('harpoon.ui').toggle_quick_menu()<cr>"; desc = "Harpoon"; }
{ key = "<leader>h1"; cmd = "<cmd>lua require('harpoon.ui').nav_file(1)<cr>"; desc = "Harpoon file 1"; }
{ key = "<leader>h2"; cmd = "<cmd>lua require('harpoon.ui').nav_file(2)<cr>"; desc = "Harpoon file 2"; }
{ key = "<leader>h3"; cmd = "<cmd>lua require('harpoon.ui').nav_file(3)<cr>"; desc = "Harpoon file 3"; }
{ key = "<leader>h4"; cmd = "<cmd>lua require('harpoon.ui').nav_file(4)<cr>"; desc = "Harpoon file 4"; }
];
opts = { };
}
]; ];
} }

View file

@ -1,5 +0,0 @@
require("copilot").setup({
suggestion = { enabled = false },
panel = { enabled = false },
})
vim.cmd("Copilot disable")

View file

@ -3,7 +3,6 @@ local null_ls = require("null-ls")
null_ls.setup({ null_ls.setup({
sources = { sources = {
-- Code actions -- Code actions
null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.code_actions.shellcheck, null_ls.builtins.code_actions.shellcheck,
null_ls.builtins.code_actions.statix, null_ls.builtins.code_actions.statix,
-- Completion -- Completion

View file

@ -2,6 +2,14 @@ local cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
return false
end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil
end
cmp.setup({ cmp.setup({
formatting = { formatting = {
format = require("lspkind").cmp_format({ format = require("lspkind").cmp_format({
@ -9,7 +17,7 @@ cmp.setup({
maxwidth = 50, -- prevent the popup from showing more than provided characters maxwidth = 50, -- prevent the popup from showing more than provided characters
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
symbol_map = { symbol_map = {
Codeium = "", Copilot = "",
}, },
}), }),
}, },
@ -26,8 +34,8 @@ cmp.setup({
["<C-e>"] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), ["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() and has_words_before() then
cmp.select_next_item() cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
elseif luasnip.expand_or_jumpable() then elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
else else
@ -48,7 +56,7 @@ cmp.setup({
{ name = "async_path", priority = 1 }, { name = "async_path", priority = 1 },
{ name = "buffer", priority = 1 }, { name = "buffer", priority = 1 },
{ name = "luasnip", priority = 2 }, { name = "luasnip", priority = 2 },
{ name = "codeium", priority = 3 }, { name = "copilot", group_index = 3 },
{ name = "nvim_lsp", priority = 4 }, { name = "nvim_lsp", priority = 4 },
}, },
}) })

View file

@ -1,14 +1,16 @@
vim.o.timeout = true vim.o.timeout = true
vim.o.timeoutlen = 500 vim.o.timeoutlen = 500
-- buffer -- Delete
require("which-key").register({ require("which-key").register({
b = { d = {
name = "buffer", name = "delete",
b = { "<cmd>Telescope buffers<cr>", "List buffers" }, b = { "<cmd>bd<cr>", "Delete buffer" },
d = { "<cmd>bd<cr>", "Delete buffer" }, w = { "<C-w>c", "Delete window" },
}, },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })
-- buffer
require("which-key").register({ require("which-key").register({
["["] = { ["["] = {
b = { "<cmd>bprevious<cr>", "Previous buffer" }, b = { "<cmd>bprevious<cr>", "Previous buffer" },
@ -25,32 +27,6 @@ require("which-key").register({
["|"] = { "<C-w>v", "Split window horizontally" }, ["|"] = { "<C-w>v", "Split window horizontally" },
["-"] = { "<C-w>s", "Split window vertically" }, ["-"] = { "<C-w>s", "Split window vertically" },
w = { "<C-w>w", "Switch window" }, w = { "<C-w>w", "Switch window" },
d = { "<C-w>c", "Delete window" },
},
}, { prefix = "<leader>" })
-- tab
require("which-key").register({
["<tab>"] = {
name = "tab",
["<tab>"] = { "<cmd>tabnew<cr>", "New tab" },
d = { "<cmd>tabclose<cr>", "Close tab" },
},
}, { prefix = "<leader>" })
require("which-key").register({
["["] = {
t = { "<cmd>tabprevious<cr>", "Previous tab" },
},
["]"] = {
t = { "<cmd>tabnext<cr>", "Next tab" },
},
})
-- file
require("which-key").register({
f = {
name = "file/find",
n = { "<cmd>enew<cr>", "New file" },
}, },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })

View file

@ -1,5 +0,0 @@
require("nvim-lastplace").setup({
lastplace_ignore_buftype = { "quickfix", "nofile", "help" },
lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" },
lastplace_open_folds = true,
})

View file

@ -1,4 +0,0 @@
require("oil").setup()
require("which-key").register({
d = { require("oil").toggle_float, "Directory (oil)" },
}, { prefix = "<leader>t" })

View file

@ -1,4 +0,0 @@
require("smartcolumn").setup({
colorcolumn = "120",
disabled_filetypes = { "help", "text", "markdown", "dashboard" },
})

View file

@ -1 +0,0 @@
require("todo-comments").setup()

View file

@ -0,0 +1,42 @@
{ lib, pkgs, ... }:
with builtins;
{
config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
{
plugin = nvim-treesitter;
event = [ "BufReadPost" "BufNewFile" ];
conf =
let
parserDir = pkgs.symlinkJoin {
name = "tresitter-grammars-all";
paths = lib.attrValues (lib.filterAttrs (_: builtins.isAttrs) nvim-treesitter-parsers);
};
in
readFile ./lua/nvim-treesitter.lua + ''
vim.opt.runtimepath:append("${parserDir}")
require'nvim-treesitter.configs'.setup {
parser_install_dir = "${parserDir}",
}
'';
dependencies = [
{ plugin = nvim-ts-context-commentstring; }
];
}
{
plugin = nvim-treesitter-textsubjects;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./lua/nvim-treesitter-textsubjects.lua;
}
{
plugin = nvim-treesitter-context;
event = [ "BufReadPost" "BufNewFile" ];
opts = { };
}
{
plugin = hmts-nvim;
ft = [ "nix" ];
}
];
}

View file

@ -1 +0,0 @@
require("trouble").setup()

View file

@ -0,0 +1,47 @@
{ pkgs, ... }:
with builtins;
{
config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
{
plugin = which-key-nvim;
lazy = false;
conf = readFile ./lua/which-key-nvim.lua;
}
{
plugin = catppuccin-nvim;
conf = readFile ./lua/catppuccin-nvim.lua;
lazy = false;
priority = 99;
}
{
plugin = todo-comments-nvim;
event = [ "BufReadPost" "BufNewFile" ];
dependencies = [{ plugin = plenary-nvim; }];
opts = { };
}
{
plugin = statuscol-nvim;
event = [ "VeryLazy" ];
conf = readFile ./lua/statuscol-nvim.lua;
}
{
plugin = smartcolumn-nvim;
event = [ "BufReadPost" "BufNewFile" ];
opts = {
colorcolumn = "120";
disabled_filetypes = [ "help" "text" "markdown" "dashboard" ];
};
}
{
plugin = dressing-nvim;
event = [ "VeryLazy" ];
}
{
plugin = gitsigns-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./lua/gitsigns-nvim.lua;
dependencies = [{ plugin = which-key-nvim; }];
}
];
}

View file

@ -17,7 +17,7 @@ in
gateway = "vpn.uni-leipzig.de"; gateway = "vpn.uni-leipzig.de";
protocol = "anyconnect"; protocol = "anyconnect";
user = "mb18cele@uni-leipzig.de"; user = "mb18cele@uni-leipzig.de";
# NOTE file content as follows: # NOTE: file content as follows:
# <my_password> # <my_password>
# "1-Standard-Uni" or "2-Spezial-Alles" # "1-Standard-Uni" or "2-Spezial-Alles"
# Explanation: # Explanation:

View file

@ -2,16 +2,14 @@ _:
final: _: final: _:
with final.lib; with final.lib;
{ rec {
writeFishApplication = fishFile =
{ name { name
, text , destination
, completions ? null , content
, runtimeInputs ? [ ]
, checkPhase ? null , checkPhase ? null
}: }:
let final.writeTextFile {
fishFile = destination: content: final.writeTextFile {
inherit name destination; inherit name destination;
executable = true; executable = true;
allowSubstitutes = true; allowSubstitutes = true;
@ -19,8 +17,6 @@ with final.lib;
text = '' text = ''
#!${getExe final.fish} #!${getExe final.fish}
${optionalString (runtimeInputs != [ ]) ''export PATH="${makeBinPath runtimeInputs}:$PATH"''}
${content} ${content}
''; '';
@ -33,8 +29,29 @@ with final.lib;
else checkPhase; else checkPhase;
}; };
script = fishFile "/bin/${name}" text; writeFishApplication =
completions_file = fishFile "/share/fish/vendor_completions.d/${name}.fish" completions; { name
, text
, completions ? null
, runtimeInputs ? [ ]
, checkPhase ? null
}:
let
runtimeHeader = optionalString (runtimeInputs != [ ])
''export PATH="${makeBinPath runtimeInputs}:$PATH"'';
script = fishFile {
inherit checkPhase;
name = "${name}_script";
destination = "/bin/${name}";
content = concatLines [ runtimeHeader text ];
};
completions_file = fishFile {
inherit checkPhase;
name = "${name}_completions";
destination = "/share/fish/vendor_completions.d/${name}.fish";
content = concatLines [ runtimeHeader completions ];
};
in in
final.symlinkJoin { final.symlinkJoin {
inherit name; inherit name;

View file

@ -11,6 +11,7 @@ final: prev:
version = lib.my.mkVersionInput inputs.rofi-wayland; version = lib.my.mkVersionInput inputs.rofi-wayland;
}); });
timers = inputs.timers.packages.${prev.system}.default; timers = inputs.timers.packages.${prev.system}.default;
hyprland = inputs.hyprland.packages.${prev.system}.default;
fzf1 = final.writeShellApplication { fzf1 = final.writeShellApplication {
name = "fzf1"; name = "fzf1";

View file

@ -4,8 +4,6 @@ _: prev:
with lib.my; with lib.my;
{ {
vimPlugins = prev.vimPlugins // { vimPlugins = prev.vimPlugins // {
inherit (inputs.codeium-nvim.packages.${prev.system}.vimPlugins) codeium-nvim;
smartcolumn-nvim = prev.vimUtils.buildVimPluginFrom2Nix { smartcolumn-nvim = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "smartcolumn-nvim"; pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim; version = mkVersionInput inputs.smartcolumn-nvim;