[feat] Use nix-index-database

This commit is contained in:
Uttarayan Mondal
2024-03-13 00:00:55 +05:30
parent 6fcac28663
commit 5b83bd79c0
5 changed files with 220 additions and 9 deletions

View File

@@ -14,7 +14,8 @@ in
home.packages = with pkgs; home.packages = with pkgs;
[ [
psst gnupg
gpg-tui
comma comma
neovide neovide
sqls sqls
@@ -32,7 +33,6 @@ in
bottom bottom
qmk qmk
nodejs nodejs
nix-index
macchina macchina
ripgrep ripgrep
fd fd
@@ -50,6 +50,7 @@ in
(nerdfonts.override { fonts = [ "Hasklig" ]; }) (nerdfonts.override { fonts = [ "Hasklig" ]; })
mpv mpv
] ++ lib.optionals device.isLinux [ ] ++ lib.optionals device.isLinux [
psst
gnome.seahorse gnome.seahorse
gnome.nautilus gnome.nautilus
nextcloud-client nextcloud-client
@@ -110,7 +111,10 @@ in
userName = "uttarayan21"; userName = "uttarayan21";
userEmail = "email@uttarayan.me"; userEmail = "email@uttarayan.me";
}; };
nix-index.enableFishIntegration = true; nix-index = {
enable = true;
enableFishIntegration = true;
};
fish = { fish = {
enable = true; enable = true;
shellAbbrs = { shellAbbrs = {
@@ -228,9 +232,8 @@ in
file = { file = {
".config/tmux/sessions".source = ../../tmux/sessions; ".config/tmux/sessions".source = ../../tmux/sessions;
".config/macchina".source = ../../macchina; ".config/macchina".source = ../../macchina;
# catppuccin themes for fish
".config/fish/themes".source = pkgs.catppuccinThemes.fish + "/themes"; ".config/fish/themes".source = pkgs.catppuccinThemes.fish + "/themes";
".cache/nix-index".source = pkgs.nix-index-database;
} // (if lazy then { } // (if lazy then {
".config/nvim/lua".source = ../../nvim/lua; ".config/nvim/lua".source = ../../nvim/lua;
".config/nvim/init.lua".source = ../../nvim/init.lua; ".config/nvim/init.lua".source = ../../nvim/init.lua;

View File

@@ -177,6 +177,18 @@
trouble-nvim trouble-nvim
crates-nvim crates-nvim
sqls-nvim sqls-nvim
# (nvim-treesitter.withPlugins (_: nvim-treesitter.allGrammars ++ [
# (pkgs.tree-sitter.buildGrammar {
# language = "just";
# version = "8af0aab";
# src = pkgs.fetchFromGitHub {
# owner = "IndianBoy42";
# repo = "tree-sitter-just";
# rev = "8af0aab79854aaf25b620a52c39485849922f766";
# sha256 = "sha256-hYKFidN3LHJg2NLM1EiJFki+0nqi1URnoLLPknUbFJY=";
# };
# })
# ]))
# No more postman # No more postman
rest-nvim rest-nvim
@@ -188,9 +200,159 @@
# Utils # Utils
FTerm-nvim FTerm-nvim
plenary-nvim plenary-nvim
nix-develop-nvim
]; ];
extraConfigLua = builtins.readFile ./extraConfig.lua; extraConfigLua = /* lua */ ''
require('rest-nvim').setup()
require('telescope').setup {
defaults = {
initial_mode = 'insert',
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
}
}
}
require('telescope').load_extension("ui-select")
require('telescope').load_extension("dap")
require('telescope').load_extension("fzf")
require('telescope').load_extension("file_browser")
require('telescope').load_extension("rest")
vim.g.rustaceanvim = {
tools = {
enable_clippy = false,
},
server = {
capabilities = require 'lsp-zero'.get_capabilities(),
on_attach = function(client, bufnr)
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(bufnr, true)
end
end,
},
dap = {
autoload_configurations = false
},
}
require("copilot").setup({
suggestion = {
enabled = true,
auto_trigger = true,
keymap = {
accept = "<C-l>",
}
},
panel = { enabled = true },
})
require 'fidget'.setup()
-- =======================================================================
-- nvim-cmp
-- =======================================================================
local cmp = require("cmp")
cmp.setup({
view = {
entries = { name = 'custom', selection_order = 'near_cursor' }
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
sources = cmp.config.sources({
{ name = "copilot", },
{ name = 'buffer' },
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'treesitter' },
{ name = 'path' },
{ name = 'git' },
{ name = 'tmux' }
}),
mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm(),
['<C-y>'] = cmp.mapping.complete(),
-- ['<C-Space>'] = cmp.mapping.complete(),
['<C-n>'] = cmp.config.next,
['<C-p>'] = cmp.config.prev,
})
})
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline {
['<C-n>'] = cmp.config.disable,
['<C-p>'] = cmp.config.disable,
},
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline {
['<C-n>'] = cmp.config.disable,
['<C-p>'] = cmp.config.disable,
},
-- mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
}, {
{ name = 'buffer' },
})
})
require('crates').setup()
require('outline').setup()
require("noice").setup({
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = true, -- add a border to hover docs and signature help
},
})
require 'FTerm'.setup({
border = 'double',
dimensions = {
height = 0.95,
width = 0.95,
},
cmd = "fish",
blend = 10,
})
'';
# builtins.readFile ./extraConfig.lua;
package = pkgs.neovim-nightly; package = pkgs.neovim-nightly;
}; };
} }

41
config/nix/flake.lock generated
View File

@@ -419,7 +419,7 @@
}, },
"haumea": { "haumea": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_5"
}, },
"locked": { "locked": {
"lastModified": 1685133229, "lastModified": 1685133229,
@@ -672,6 +672,24 @@
"type": "github" "type": "github"
} }
}, },
"nix-index-database": {
"inputs": {
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1710120787,
"narHash": "sha256-tlLuB73OCOKtU2j83bQzSYFyzjJo3rjpITZE5MoofG8=",
"owner": "Mic92",
"repo": "nix-index-database",
"rev": "e76ff2df6bfd2abe06abd8e7b9f217df941c1b07",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "nix-index-database",
"type": "github"
}
},
"nixneovim": { "nixneovim": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_7", "flake-utils": "flake-utils_7",
@@ -806,6 +824,22 @@
} }
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": {
"lastModified": 1709703039,
"narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1681001314, "lastModified": 1681001314,
"narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=", "narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=",
@@ -820,7 +854,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": { "nixpkgs_6": {
"locked": { "locked": {
"lastModified": 1709703039, "lastModified": 1709703039,
"narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=",
@@ -955,8 +989,9 @@
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"neovim-nightly-overlay": "neovim-nightly-overlay", "neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nix-index-database": "nix-index-database",
"nixneovim": "nixneovim", "nixneovim": "nixneovim",
"nixpkgs": "nixpkgs_5", "nixpkgs": "nixpkgs_6",
"nur": "nur" "nur": "nur"
} }
}, },

View File

@@ -47,6 +47,8 @@
# nixneovimplugins = { # nixneovimplugins = {
# url = "github:NixNeovim/NixNeovimPlugins"; # url = "github:NixNeovim/NixNeovimPlugins";
# inputs.nixpkgs.follows = "nixpkgs"; # inputs.nixpkgs.follows = "nixpkgs";
# }
nix-index-database.url = "github:Mic92/nix-index-database";
nur.url = "github:nix-community/nur"; nur.url = "github:nix-community/nur";

View File

@@ -9,6 +9,7 @@ let
}; };
vimPlugins = final: prev: { vimPlugins = final: prev: {
vimPlugins = prev.vimPlugins // { vimPlugins = prev.vimPlugins // {
# nvim-treesitter
comfortable-motion = final.pkgs.vimUtils.buildVimPlugin { comfortable-motion = final.pkgs.vimUtils.buildVimPlugin {
name = "comfortable-motion"; name = "comfortable-motion";
src = final.pkgs.fetchFromGitHub { src = final.pkgs.fetchFromGitHub {
@@ -66,6 +67,13 @@ let
catppuccinThemes = catppuccinThemes =
import ./themes/catppuccin.nix { pkgs = final.pkgs; }; import ./themes/catppuccin.nix { pkgs = final.pkgs; };
}; };
nix-index-db = (final: prev: {
nix-index-database = final.runCommandLocal "nix-index-database" { } ''
mkdir -p $out
ln -s ${inputs.nix-index-database.legacyPackages.${prev.system}.database} $out/files
'';
});
in in
[ [
catppuccinThemes catppuccinThemes
@@ -76,4 +84,5 @@ in
inputs.nixneovim.overlays.default inputs.nixneovim.overlays.default
# inputs.nixneovimplugins.overlays.default # inputs.nixneovimplugins.overlays.default
inputs.nur.overlay inputs.nur.overlay
nix-index-db
] ]