Compare commits
2 commits
421a05a82f
...
69cbed2ea9
Author | SHA1 | Date | |
---|---|---|---|
69cbed2ea9 | |||
3b9b7d3c01 |
13 changed files with 228 additions and 143 deletions
|
@ -5,7 +5,7 @@ My configuration is simple: I have one personal laptop with one user.
|
|||
|
||||
## Features
|
||||
|
||||
- Nixpkgs 23.05
|
||||
- Nixpkgs 23.11
|
||||
- Flakes!
|
||||
- [Nix User Repository (NUR)](https://github.com/nix-community/NUR)
|
||||
- Currently only used for Firefox Plugins
|
||||
|
|
39
flake.lock
39
flake.lock
|
@ -53,14 +53,14 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1700392168,
|
||||
"narHash": "sha256-v5LprEFx3u4+1vmds9K0/i7sHjT0IYGs7u9v54iz/OA=",
|
||||
"lastModified": 1700814205,
|
||||
"narHash": "sha256-lWqDPKHRbQfi+zNIivf031BUeyciVOtwCwTjyrhDB5g=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz"
|
||||
"url": "https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz"
|
||||
"url": "https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz"
|
||||
}
|
||||
},
|
||||
"homeage": {
|
||||
|
@ -101,27 +101,43 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1700678569,
|
||||
"narHash": "sha256-2Ki+2UvOidxEb3xB4ADqlbPQ2BZOF4uZMR094O8or2I=",
|
||||
"lastModified": 1701389149,
|
||||
"narHash": "sha256-rU1suTIEd5DGCaAXKW6yHoCfR1mnYjOXQFOaH7M23js=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8f1180704ac35baded1a74164365ac7cdfba6f38",
|
||||
"rev": "5de0b32be6e85dc1a9404c75131316e4ffbc634c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-23.05",
|
||||
"ref": "nixos-23.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1701040486,
|
||||
"narHash": "sha256-vawYwoHA5CwvjfqaT3A5CT9V36Eq43gxdwpux32Qkjw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "45827faa2132b8eade424f6bdd48d8828754341a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1700855055,
|
||||
"narHash": "sha256-QKjcrEntfghcXBsrenDE46OxaF/4YQVStAQfyDOQcPA=",
|
||||
"lastModified": 1700923974,
|
||||
"narHash": "sha256-3SWdqep5XzFEuK+5iJkDe/mTIvidS3Gs47W/DVXuRnE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "ebf2c68214f10ee5b9372ae4960a7b54af514bd3",
|
||||
"rev": "2644c4a32642a32ea01dc63fd780404c21c82d7a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -137,6 +153,7 @@
|
|||
"homeage": "homeage",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"nur": "nur"
|
||||
}
|
||||
}
|
||||
|
|
23
flake.nix
23
flake.nix
|
@ -2,11 +2,12 @@
|
|||
description = "My NixOS configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
nur.url = "github:nix-community/NUR";
|
||||
home-manager = {
|
||||
url =
|
||||
"https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz";
|
||||
"https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
homeage = {
|
||||
|
@ -21,14 +22,24 @@
|
|||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ nixpkgs, home-manager, homeage, agenix, nur, nixos-hardware, ... }: {
|
||||
outputs = { nixpkgs, nixpkgs-unstable, home-manager, homeage, agenix, nur
|
||||
, nixos-hardware, ... }: {
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt;
|
||||
|
||||
nixosConfigurations.pim = nixpkgs.lib.nixosSystem {
|
||||
nixosConfigurations.pim = nixpkgs.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
{ nixpkgs.overlays = [ nur.overlay ]; }
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
nur.overlay
|
||||
(final: _prev: {
|
||||
unstable = import nixpkgs-unstable {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
./nixos
|
||||
agenix.nixosModules.default
|
||||
nixos-hardware.nixosModules.lenovo-thinkpad-x260
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
programs.bash = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
dig = "dog";
|
||||
htop = "btop";
|
||||
gp = "git push";
|
||||
gco = "git checkout";
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
require("bufferline").setup {
|
||||
options = {
|
||||
diagnostics = 'nvim_lsp',
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
local icon = level:match("error") and " " or " "
|
||||
return " " .. icon .. count
|
||||
end,
|
||||
separator_style = "slant",
|
||||
hover = {enabled = true, reveal = {'close'}}
|
||||
}
|
||||
}
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
local icon = level:match("error") and " " or " "
|
||||
return " " .. icon .. count
|
||||
end,
|
||||
separator_style = "slant",
|
||||
hover = { enabled = true, reveal = { "close" } },
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>ft', ":BufferLinePick<CR>", {})
|
||||
vim.keymap.set("n", "<leader>ft", ":BufferLinePick<CR>", {})
|
||||
|
|
|
@ -1,39 +1,43 @@
|
|||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
luasnip.config.setup {}
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
luasnip.config.setup({})
|
||||
|
||||
cmp.setup {
|
||||
snippet = {expand = function(args) luasnip.lsp_expand(args.body) end},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {'i', 's'}),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {'i', 's'})
|
||||
},
|
||||
sources = {{name = 'nvim_lsp'}, {name = 'luasnip'}}
|
||||
}
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete({}),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = { { name = "nvim_lsp" }, { name = "luasnip" } },
|
||||
})
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
neofetch
|
||||
gopls
|
||||
terraform-ls
|
||||
luaformatter
|
||||
efm-langserver
|
||||
nixfmt
|
||||
stylua
|
||||
black
|
||||
];
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
|
@ -69,6 +69,11 @@
|
|||
}
|
||||
nvim-web-devicons
|
||||
lsp-format-nvim
|
||||
{
|
||||
plugin = pkgs.unstable.vimPlugins.none-ls-nvim;
|
||||
type = "lua";
|
||||
config = builtins.readFile ./none-ls.lua;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require('leap').add_default_mappings()
|
||||
require("leap").add_default_mappings()
|
||||
-- Don't remap 'x' in visual mode.
|
||||
vim.keymap.del({'x', 'o'}, 'x')
|
||||
vim.keymap.del({'x', 'o'}, 'X')
|
||||
vim.keymap.del({ "x", "o" }, "x")
|
||||
vim.keymap.del({ "x", "o" }, "X")
|
||||
|
|
|
@ -1,59 +1,58 @@
|
|||
require("lsp-format").setup {}
|
||||
require("lsp-format").setup({})
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
local bufmap = function(keys, func)
|
||||
vim.keymap.set('n', keys, func, {buffer = bufnr})
|
||||
end
|
||||
local bufmap = function(keys, func)
|
||||
vim.keymap.set("n", keys, func, { buffer = bufnr })
|
||||
end
|
||||
|
||||
bufmap('<leader>r', vim.lsp.buf.rename)
|
||||
bufmap('<leader>a', vim.lsp.buf.code_action)
|
||||
bufmap("<leader>r", vim.lsp.buf.rename)
|
||||
bufmap("<leader>a", vim.lsp.buf.code_action)
|
||||
|
||||
bufmap('gd', vim.lsp.buf.definition)
|
||||
bufmap('gD', vim.lsp.buf.declaration)
|
||||
bufmap('gI', vim.lsp.buf.implementation)
|
||||
bufmap('<leader>D', vim.lsp.buf.type_definition)
|
||||
bufmap("gd", vim.lsp.buf.definition)
|
||||
bufmap("gD", vim.lsp.buf.declaration)
|
||||
bufmap("gI", vim.lsp.buf.implementation)
|
||||
bufmap("<leader>D", vim.lsp.buf.type_definition)
|
||||
|
||||
bufmap('gr', require('telescope.builtin').lsp_references)
|
||||
bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)
|
||||
bufmap('<leader>S',
|
||||
require('telescope.builtin').lsp_dynamic_workspace_symbols)
|
||||
bufmap("gr", require("telescope.builtin").lsp_references)
|
||||
bufmap("<leader>s", require("telescope.builtin").lsp_document_symbols)
|
||||
bufmap("<leader>S", require("telescope.builtin").lsp_dynamic_workspace_symbols)
|
||||
|
||||
bufmap('K', vim.lsp.buf.hover)
|
||||
bufmap("K", vim.lsp.buf.hover)
|
||||
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format',
|
||||
function(_) vim.lsp.buf.format() end,
|
||||
{})
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, {})
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||
|
||||
require('neodev').setup()
|
||||
require'lspconfig'.nil_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
require'lspconfig'.pyright.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
require'lspconfig'.gopls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
require'lspconfig'.terraformls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
require("neodev").setup()
|
||||
require("lspconfig").nil_ls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("lspconfig").pyright.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("lspconfig").gopls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("lspconfig").terraformls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require'lspconfig'.efm.setup {
|
||||
on_attach = require("lsp-format").on_attach,
|
||||
init_options = {documentFormatting = true},
|
||||
settings = {
|
||||
languages = {
|
||||
lua = {{formatCommand = "lua-format -i", formatStdin = true}},
|
||||
nix = {{formatCommand = "nixfmt", formatStdin = true}}
|
||||
}
|
||||
},
|
||||
filetypes = {"lua", "nix"}
|
||||
}
|
||||
-- require'lspconfig'.efm.setup {
|
||||
-- on_attach = require("lsp-format").on_attach,
|
||||
-- init_options = {documentFormatting = true},
|
||||
-- settings = {
|
||||
-- languages = {
|
||||
-- lua = {{formatCommand = "lua-format -i", formatStdin = true}},
|
||||
-- nix = {{formatCommand = "nixfmt", formatStdin = true}}
|
||||
-- }
|
||||
-- },
|
||||
-- filetypes = {"lua", "nix"}
|
||||
-- }
|
||||
|
|
51
home-manager/neovim/none-ls.lua
Normal file
51
home-manager/neovim/none-ls.lua
Normal file
|
@ -0,0 +1,51 @@
|
|||
-- renamed to none-ls
|
||||
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local code_actions = null_ls.builtins.code_actions
|
||||
|
||||
-- to setup format on save
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
formatting.stylua,
|
||||
formatting.black,
|
||||
},
|
||||
|
||||
-- configure format on save
|
||||
on_attach = function(current_client, bufnr)
|
||||
if current_client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({
|
||||
filter = function(client)
|
||||
-- only use null-ls for formatting instead of lsp server
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
bufnr = bufnr,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- formatting command
|
||||
vim.api.nvim_create_user_command("Format", function()
|
||||
vim.lsp.buf.format(nil, 10000)
|
||||
end, {})
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>fm",
|
||||
":Format<CR>",
|
||||
{ desc = "Format current buffer (also done on save)", noremap = true, silent = true }
|
||||
)
|
|
@ -1,17 +1,17 @@
|
|||
local builtin = require('telescope.builtin')
|
||||
local builtin = require("telescope.builtin")
|
||||
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
||||
vim.keymap.set('n', '<leader>fr', builtin.lsp_references, {})
|
||||
vim.keymap.set('n', '<leader>fs', builtin.lsp_document_symbols, {})
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, {})
|
||||
vim.keymap.set("n", "<leader>fr", builtin.lsp_references, {})
|
||||
vim.keymap.set("n", "<leader>fs", builtin.lsp_document_symbols, {})
|
||||
|
||||
require('telescope').setup {
|
||||
pickers = {
|
||||
find_files = {theme = "dropdown"},
|
||||
live_grep = {theme = "dropdown"},
|
||||
buffers = {theme = "dropdown"},
|
||||
lsp_references = {theme = "dropdown"},
|
||||
lsp_document_symbols = {theme = "dropdown"}
|
||||
}
|
||||
}
|
||||
require("telescope").setup({
|
||||
pickers = {
|
||||
find_files = { theme = "dropdown" },
|
||||
live_grep = { theme = "dropdown" },
|
||||
buffers = { theme = "dropdown" },
|
||||
lsp_references = { theme = "dropdown" },
|
||||
lsp_document_symbols = { theme = "dropdown" },
|
||||
},
|
||||
})
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = {},
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {},
|
||||
|
||||
auto_install = false,
|
||||
auto_install = false,
|
||||
|
||||
highlight = {enable = true},
|
||||
|
||||
indent = {enable = true}
|
||||
}
|
||||
highlight = { enable = true },
|
||||
|
||||
indent = { enable = true },
|
||||
})
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
};
|
||||
|
||||
environment = {
|
||||
systemPackages = with pkgs; [ wget curl git btop ripgrep vim dogdns tree ];
|
||||
systemPackages = with pkgs; [ wget curl git btop ripgrep vim dogdns tree dig ];
|
||||
gnome.excludePackages = with pkgs; [
|
||||
gnome.totem
|
||||
gnome-tour
|
||||
|
|
Loading…
Reference in a new issue