refactor: clean up a bit

nixos
Moritz Böhme 2024-06-17 09:59:39 +02:00
parent bee307ae9c
commit a5a784b2d5
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
4 changed files with 69 additions and 51 deletions

View File

@ -4,8 +4,8 @@
, ...
}:
with lib;
let
inherit (lib) mkEnableOption mkIf mkDefault;
cfg = config.my.profiles.desktop;
in
{
@ -101,10 +101,6 @@ in
})
];
nixpkgs.config.permittedInsecurePackages = [
"electron-25.9.0" # obsidian
];
programs.nix-ld.enable = true;
home-manager.users.moritz = {

View File

@ -1,8 +1,8 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
let
cfg = config.my.programs.nvim;
inherit (lib) mkEnableOption mkIf readFile;
in
{
imports = lib.my.listModulesRec ./plugins;

View File

@ -1,26 +1,28 @@
{ pkgs, lib, inputs, ... }:
with builtins;
let
inherit (builtins) readFile;
in
{
config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
config.home-manager.users.moritz.programs.neovim.lazy.plugins = [
{
plugin = oil-nvim;
plugin = pkgs.vimPlugins.oil-nvim;
lazy = false;
opts = { };
dependencies = [{ plugin = nvim-web-devicons; }];
dependencies = [{ plugin = pkgs.vimPlugins.nvim-web-devicons; }];
}
{
plugin = lualine-nvim;
plugin = pkgs.vimPlugins.lualine-nvim;
opts = { };
dependencies = [{ plugin = nvim-web-devicons; }];
dependencies = [{ plugin = pkgs.vimPlugins.nvim-web-devicons; }];
}
{
plugin = mini-nvim;
plugin = pkgs.vimPlugins.mini-nvim;
lazy = false;
conf = readFile ./lua/mini-nvim.lua;
}
{
plugin = nvim-cmp;
plugin = pkgs.vimPlugins.nvim-cmp;
keys = [
{ key = "<leader>tc"; cmd = "<cmd>CmpToggle<cr>"; desc = "Toggle Cmp sources"; }
];
@ -28,26 +30,43 @@ with builtins;
event = [ "InsertEnter" ];
dependencies = [
{
plugin = nvim-autopairs;
plugin = pkgs.vimPlugins.nvim-autopairs;
opts = { };
}
{ plugin = cmp-async-path; }
{ plugin = cmp-buffer; }
{ plugin = cmp-cmdline; }
{ plugin = cmp-nvim-lsp; }
{ plugin = cmp_luasnip; }
{ plugin = cmp-spell; }
{ plugin = cmp-nvim-lsp-signature-help; }
{ plugin = friendly-snippets; }
{ plugin = lspkind-nvim; }
{ plugin = pkgs.vimPlugins.cmp-async-path; }
{ plugin = pkgs.vimPlugins.cmp-buffer; }
{ plugin = pkgs.vimPlugins.cmp-cmdline; }
{ plugin = pkgs.vimPlugins.cmp-nvim-lsp; }
{ plugin = pkgs.vimPlugins.cmp_luasnip; }
{ plugin = pkgs.vimPlugins.cmp-spell; }
{ plugin = pkgs.vimPlugins.cmp-nvim-lsp-signature-help; }
{
plugin = luasnip;
plugin = pkgs.vimPlugins.copilot-cmp;
opts = { };
dependencies = [
{
plugin = pkgs.vimPlugins.copilot-lua;
opts = {
suggestion = { enabled = false; };
panel = { enabled = false; };
};
conf = /* lua */ ''
require("copilot").setup(opts)
vim.cmd("Copilot disable")
'';
}
];
}
{ plugin = pkgs.vimPlugins.friendly-snippets; }
{ plugin = pkgs.vimPlugins.lspkind-nvim; }
{
plugin = pkgs.vimPlugins.luasnip;
conf = readFile ./lua/luasnip.lua;
}
];
}
{
plugin = direnv-vim;
plugin = pkgs.vimPlugins.direnv-vim;
lazy = false;
}
{
@ -60,25 +79,26 @@ with builtins;
dependencies = [
{
# TODO: add all required tools to neovim or silence warnings
plugin = pkgs.vimPlugins.null-ls-nvim.overrideAttrs (_: {
version = lib.my.mkVersionInput inputs.none-ls-nvim;
src = inputs.none-ls-nvim;
});
plugin = pkgs.vimPlugins.none-ls-nvim;
conf = readFile ./lua/null-ls-nvim.lua;
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = plenary-nvim; }
{
plugin = pkgs.vimUtils.buildVimPlugin {
pname = "none-ls-shellcheck.nvim";
version = lib.my.mkVersionInput inputs.none-ls-shellcheck-nvim;
src = inputs.none-ls-shellcheck-nvim;
};
}
];
}
{ plugin = which-key-nvim; }
{ plugin = lsp_lines-nvim; }
{ plugin = pkgs.vimPlugins.lsp_lines-nvim; }
{
plugin = inc-rename-nvim;
plugin = pkgs.vimPlugins.inc-rename-nvim;
opts = {
input_buffer_type = "dressing";
};
dependencies = [
{ plugin = dressing-nvim; }
{ plugin = pkgs.vimPlugins.dressing-nvim; }
];
}
{
@ -91,7 +111,7 @@ with builtins;
];
}
{
plugin = vim-fugitive;
plugin = pkgs.vimPlugins.vim-fugitive;
cmd = [
"G"
"Git"
@ -122,11 +142,11 @@ with builtins;
];
}
{
plugin = vim-tmux-navigator;
plugin = pkgs.vimPlugins.vim-tmux-navigator;
event = [ "VeryLazy" ];
}
{
plugin = nvim-lastplace;
plugin = pkgs.vimPlugins.nvim-lastplace;
event = [ "BufReadPost" "BufNewFile" ];
opts = {
lastplace_ignore_buftype = [ "quickfix" "nofile" "help" ];
@ -135,7 +155,7 @@ with builtins;
};
}
{
plugin = telescope-nvim;
plugin = pkgs.vimPlugins.telescope-nvim;
cmd = [ "Telescope" ];
conf = builtins.readFile ./lua/telescope.lua;
keys = [
@ -159,31 +179,31 @@ with builtins;
{ key = "<leader>fr"; cmd = "<cmd>Telescope oldfiles<cr>"; desc = "Recent files"; }
];
dependencies = [
{ plugin = plenary-nvim; }
{ plugin = telescope-fzf-native-nvim; }
{ plugin = pkgs.vimPlugins.plenary-nvim; }
{ plugin = pkgs.vimPlugins.telescope-fzf-native-nvim; }
];
}
{
plugin = vim-startuptime;
plugin = pkgs.vimPlugins.vim-startuptime;
cmd = [ "StartupTime" ];
conf = readFile ./lua/vim-startuptime.lua;
}
{
plugin = typst-vim;
plugin = pkgs.vimPlugins.typst-vim;
ft = [ "typst" "typ" ];
}
{
plugin = comment-nvim;
plugin = pkgs.vimPlugins.comment-nvim;
event = [ "BufReadPost" "BufNewFile" ];
opts = { };
}
{
plugin = nvim-surround;
plugin = pkgs.vimPlugins.nvim-surround;
event = [ "BufReadPost" "BufNewFile" ];
opts = { };
}
{
plugin = conform-nvim;
plugin = pkgs.vimPlugins.conform-nvim;
keys = [
{ key = "="; cmd = "<cmd>lua require('conform').format()<cr>"; desc = "format buffer"; mode = [ "n" "v" ]; }
];

View File

@ -4,8 +4,10 @@
, ...
}:
with lib;
let
inherit (lib) range filterAttrs attrNames foldl' head tail mkOption mkEnableOption intersectLists genAttrs flip getAttr;
inherit (lib.types) listOf enum package;
cfg = config.my.programs.python;
pythonVersions = map (version: "3${toString version}") (range 8 11);
@ -23,7 +25,7 @@ let
enable = mkEnableOption (toString version);
pythonPackages = mkOption {
default = [ ];
type = with types; listOf (enum (pythonPackages version));
type = listOf (enum (pythonPackages version));
};
};
in
@ -32,11 +34,11 @@ in
versions = genAttrs pythonVersions versionOpts;
defaultPackages = mkOption {
default = [ ];
type = with types; listOf (enum commonPackages);
type = listOf (enum commonPackages);
};
extraPackages = mkOption {
default = [ ];
type = with types; listOf package;
type = listOf package;
};
};