From df229f0856dcdb6a888d8a2e3419425385812616 Mon Sep 17 00:00:00 2001 From: Nicolai Van der Storm Date: Wed, 18 Oct 2023 18:04:57 +0200 Subject: [PATCH] general fixes plus nvim transparent --- flake.lock | 6 +-- flake.nix | 2 +- nix/users/base/neovim/default.nix | 49 ++++++++++++------- nix/users/base/neovim/plugins/transparent.lua | 34 +++++++++++++ nix/users/nicolaivds/default.nix | 1 + nix/users/nicolaivds/general/packages.nix | 3 ++ 6 files changed, 74 insertions(+), 21 deletions(-) create mode 100644 nix/users/base/neovim/plugins/transparent.lua diff --git a/flake.lock b/flake.lock index 42090a5..6a0f2e5 100644 --- a/flake.lock +++ b/flake.lock @@ -167,11 +167,11 @@ }, "nur": { "locked": { - "lastModified": 1697620530, - "narHash": "sha256-yP1UqYQXHrA7QmXUHqlx9lVEBjzmtLPOJwmEk8fyUeY=", + "lastModified": 1697637981, + "narHash": "sha256-BReinxzdLksrjXkCZWqHZSEKd4/vWuNwgzmfjKprRxo=", "owner": "nix-community", "repo": "NUR", - "rev": "51314cbd9e37c1ed544e336b60a0ac73e1709a13", + "rev": "bc8feb3239c1a4a896fd03ada155d1b8ee8ae38c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 32643e9..6b57f41 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ nur.url = "github:nix-community/NUR"; }; - outputs = { self, nixpkgs, home-manager, ...}@inputs: + outputs = { self, nixpkgs, home-manager, nur, ...}@inputs: let system = "x86_64-linux"; username = "nicolaivds"; diff --git a/nix/users/base/neovim/default.nix b/nix/users/base/neovim/default.nix index 0641083..0b9a27a 100644 --- a/nix/users/base/neovim/default.nix +++ b/nix/users/base/neovim/default.nix @@ -1,9 +1,18 @@ -{ inputs, pkgs, ... }: +{ inputs, pkgs, lib, ... }: { programs.neovim = let toLua = str: "lua << EOF\n${str}\nEOF\n"; toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n"; + fromGitHub = rev: ref: repo: pkgs.vimUtils.buildVimPlugin { + pname = "${lib.strings.sanitizeDerivationName repo}"; + version = ref; + src = builtins.fetchGit { + url = "https://github.com/${repo}.git"; + ref = ref; + rev = rev; + }; + }; in { enable = true; @@ -14,31 +23,31 @@ defaultEditor = true; - plugins = with pkgs.vimPlugins; [ + plugins = with pkgs; [ # Colorschemes { - plugin = catppuccin-nvim; + plugin = vimPlugins.catppuccin-nvim; config = toLuaFile ./plugins/colorschemes/catppuccin.lua; } # LSP { - plugin = nvim-lspconfig; + plugin = vimPlugins.nvim-lspconfig; config = toLuaFile ./plugins/lsp.lua; } - cmp-buffer - cmp-cmdline - cmp-nvim-lsp - cmp-nvim-lua - cmp-path - cmp_luasnip - luasnip - nvim-cmp + vimPlugins.cmp-buffer + vimPlugins.cmp-cmdline + vimPlugins.cmp-nvim-lsp + vimPlugins.cmp-nvim-lua + vimPlugins.cmp-path + vimPlugins.cmp_luasnip + vimPlugins.luasnip + vimPlugins.nvim-cmp # The rest { - plugin = indent-blankline-nvim; + plugin = vimPlugins.indent-blankline-nvim; config = toLuaFile ./plugins/indent.lua; } @@ -46,22 +55,28 @@ # TODO: enable this when treesitter is installed # { - # plugin = nvim-ts-autotag; + # plugin = vimPlugins.nvim-ts-autotag; # config = toLuaFile ./plugins/autotag.lua; # } { - plugin = nvim-colorizer-lua; + plugin = vimPlugins.nvim-colorizer-lua; config = toLuaFile ./plugins/colorizer.lua; } # GIT { - plugin = gitsigns-nvim; + plugin = vimPlugins.gitsigns-nvim; config = toLuaFile ./plugins/gitsigns.lua; } - vim-fugitive + vimPlugins.vim-fugitive + + { + plugin = (fromGitHub "3af6232c8d39d51062702e875ff6407c1eeb0391" "main" "xiyaowong/transparent.nvim"); + config = toLuaFile ./plugins/transparent.lua + } + ]; diff --git a/nix/users/base/neovim/plugins/transparent.lua b/nix/users/base/neovim/plugins/transparent.lua new file mode 100644 index 0000000..5419c10 --- /dev/null +++ b/nix/users/base/neovim/plugins/transparent.lua @@ -0,0 +1,34 @@ +local status, plugin = pcall(require, 'transparent') +if not status then + print('Plugin Error: ', plugin) + return +end + +plugin.setup({ + groups = { -- table: default groups + 'Normal', 'NormalNC', 'Comment', 'Constant', 'Special', 'Identifier', + 'Statement', 'PreProc', 'Type', 'Underlined', 'Todo', 'String', 'Function', + 'Conditional', 'Repeat', 'Operator', 'Structure', 'LineNr', 'NonText', + 'SignColumn', 'CursorLineNr', 'EndOfBuffer', + }, + extra_groups = { + "NormalFloat", -- plugins which have float panel such as Lazy, Mason, LspInfo + "NvimTreeNormal", -- NvimTree + "NvimTreeNormalNC", + "NvimTreeWinSeparator", + "TelescopeNormal", + "TelescopeBorder", + "WhichKeyFloat", + }, -- table: additional groups that should be cleared + exclude_groups = {}, -- table: groups you don't want to clear +}) +vim.g.transparent_groups = vim.list_extend( + vim.g.transparent_groups or {}, + vim.tbl_map(function(v) + return v.hl_group + end, vim.tbl_values(require('bufferline.config').highlights)) +) + +--- Fix for bufferline looking strange on startup --- +vim.cmd(":TransparentToggle") +vim.cmd(":TransparentToggle") diff --git a/nix/users/nicolaivds/default.nix b/nix/users/nicolaivds/default.nix index c082d5c..a382a44 100644 --- a/nix/users/nicolaivds/default.nix +++ b/nix/users/nicolaivds/default.nix @@ -16,6 +16,7 @@ in { _module.args = { inherit inputs username custom; }; imports = [ + inputs.nur.hmModules.nur ./general ./programs ./themes diff --git a/nix/users/nicolaivds/general/packages.nix b/nix/users/nicolaivds/general/packages.nix index 8e55113..6ce2dd2 100644 --- a/nix/users/nicolaivds/general/packages.nix +++ b/nix/users/nicolaivds/general/packages.nix @@ -2,6 +2,7 @@ { #Overlays/Overrides nixpkgs.overlays = [ + inputs.nur.overlay (self: super: { waybar = super.waybar.overrideAttrs (oldAttrs: { mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; @@ -27,6 +28,8 @@ hplipWithPlugin inputs.maxfetch.packages.${pkgs.system}.default inputs.orcaslicer.packages.${pkgs.system}.orca-slicer + jellycli + jftui libreoffice lutris mpv