Merge remote-tracking branch 'origin/nixos' into nixos-work

This commit is contained in:
Moritz Böhme 2023-03-10 08:53:34 +01:00
commit 904790c263
35 changed files with 586 additions and 502 deletions

127
flake.lock generated
View file

@ -8,11 +8,11 @@
]
},
"locked": {
"lastModified": 1677247280,
"narHash": "sha256-sa+8MtoAOSLsWP9vf0qiJUyMovIEYgDzHE8TkoK04Hk=",
"lastModified": 1677969766,
"narHash": "sha256-AIp/ZYZMNLDZR/H7iiAlaGpu4lcXsVt9JQpBlf43HRY=",
"owner": "ryantm",
"repo": "agenix",
"rev": "833f87c8ff574a29aea3e091045cbaed3cf86bc1",
"rev": "03b51fe8e459a946c4b88dcfb6446e45efb2c24e",
"type": "github"
},
"original": {
@ -69,11 +69,11 @@
]
},
"locked": {
"lastModified": 1676581287,
"narHash": "sha256-a/6ClchROZ5PoLz0WK42mkAkUtJlMDbe5QyyZZ7bomc=",
"lastModified": 1678041467,
"narHash": "sha256-qqHbiN0ZfEuZ2guMAW5T011TqgrPqGqNWlHtd8AXtQA=",
"owner": "zhaofengli",
"repo": "attic",
"rev": "0bb3d001365a5d75947a7a713dfd06307b3934d4",
"rev": "1a3b6513b02202198bb497608d0cedc45119799b",
"type": "github"
},
"original": {
@ -115,17 +115,16 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1673405853,
"narHash": "sha256-6Nq9DuOo+gE2I8z5UZaKuumykz2xxZ9JGYmUthOuwSA=",
"lastModified": 1677892403,
"narHash": "sha256-/Wi0L1spSWLFj+UQxN3j0mPYMoc7ZoAujpUF/juFVII=",
"owner": "ipetkov",
"repo": "crane",
"rev": "b13963c8c18026aa694acd98d14f66d24666f70b",
"rev": "105e27adb70a9890986b6d543a67761cbc1964a2",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"rev": "b13963c8c18026aa694acd98d14f66d24666f70b",
"type": "github"
}
},
@ -333,11 +332,11 @@
"forgit-git": {
"flake": false,
"locked": {
"lastModified": 1676021219,
"narHash": "sha256-/cqDhHilbMSrzwip+2CGJ9Il4wsx5skyMbqC98hewdc=",
"lastModified": 1677621471,
"narHash": "sha256-merUZ0IQ/qmDkquGFjKvc4vJBj4Ff62JpWYOB67lAVY=",
"owner": "wfxr",
"repo": "forgit",
"rev": "065f7841f334b8707a49ac30d19370aa859db2ed",
"rev": "801239658718863b9c6e0ba21d027cb0caccd465",
"type": "github"
},
"original": {
@ -399,11 +398,11 @@
]
},
"locked": {
"lastModified": 1677104801,
"narHash": "sha256-2V5nKOYVFMYlseYdDKiEaww2xqcE0GtS1ax3SoUX99I=",
"lastModified": 1678271387,
"narHash": "sha256-H2dv/i1LRlunRtrESirELzfPWdlG/6ElDB1ksO529H4=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "4295fdfa6b0005c32f2e1f0b732faf5810c1bc7f",
"rev": "36999b8d19eb6eebb41983ef017d7e0095316af2",
"type": "github"
},
"original": {
@ -439,11 +438,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1672071700,
"narHash": "sha256-Z0pbBVtijv4xbL42rPzMoYFSOqALFRYDMN9iOumSEso=",
"lastModified": 1677679546,
"narHash": "sha256-L+QE6hIHxhYHWPA1jfgZsbQFYxheD/hzFhtwGFRdWOk=",
"owner": "hyprwm",
"repo": "contrib",
"rev": "37c8121f98d76f57caa00dd7106877876e0d7483",
"rev": "d4eccc8e7d31d30c7ce39dc2b864c4f23f173855",
"type": "github"
},
"original": {
@ -460,11 +459,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1677162463,
"narHash": "sha256-wjZbwJvIagJ0i82LYm3eIHNsqwblOjIzAyegA3z9olA=",
"lastModified": 1678371846,
"narHash": "sha256-fOFX0PASpIpU4NK9Wen9yJKwg5RYe5jFIu1H0OUzglE=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "60e37d727def25c87a3fd6c47751c05f6082260f",
"rev": "c9167d96467f0c1546f337828e874d7dd849f900",
"type": "github"
},
"original": {
@ -499,11 +498,11 @@
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1676681260,
"narHash": "sha256-R2FvbPzgvDSVs0jCUA9CMDIgw4F6exF8cR+y3Yea5jQ=",
"lastModified": 1677282271,
"narHash": "sha256-wNooEHZpKMJN2jj2qPa1jRhi6f5q1yTYCxQcXEJ32eM=",
"owner": "hyprwm",
"repo": "hyprpaper",
"rev": "2bc88dc8c220db674f458432aec0ac0d9ea6a640",
"rev": "83867464c523c3ac2f7ce53d2c4b8d4f9b7551cd",
"type": "github"
},
"original": {
@ -515,11 +514,11 @@
"lspsaga-nvim": {
"flake": false,
"locked": {
"lastModified": 1677497543,
"narHash": "sha256-xFba/hXqc0qyJH9Hd9XtXteXIqjJnIgYIy8Y5l9QPQQ=",
"lastModified": 1678361457,
"narHash": "sha256-nrsMdfF43k0RavCq2hZ799HpY/40O0bi4kAM18dR+f4=",
"owner": "glepnir",
"repo": "lspsaga.nvim",
"rev": "291629b704ba8fdd0134ef4204fb118050bca363",
"rev": "db6cdf51bf5ae45e4aa65760e597cf0d587c66ee",
"type": "github"
},
"original": {
@ -530,11 +529,11 @@
},
"master": {
"locked": {
"lastModified": 1677259386,
"narHash": "sha256-gFXSvo9CuTJa6V0bK0Gm+JwizlJD+YyJ1VAUW2ij1R4=",
"lastModified": 1678375527,
"narHash": "sha256-0W7Xu8XJLr8wUAf0fYKI2Ese3HB1fC5b/+lS9BPVgOQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e8d97da2540b9de5962849c75c425cc2469d77ad",
"rev": "87af394014d51f563dade30f3f7ef55a00a3d1d6",
"type": "github"
},
"original": {
@ -550,11 +549,11 @@
},
"locked": {
"dir": "contrib",
"lastModified": 1677257437,
"narHash": "sha256-fxEb0DrGXv3Q03Gz/oqI8x47WhXLlGtHQFgGIhBl4c0=",
"lastModified": 1678371176,
"narHash": "sha256-tsPKurteDIU0bz9GutdRr4vwQ1kIsbJEbaY0nsz+H94=",
"owner": "neovim",
"repo": "neovim",
"rev": "15cce77b383d0b0bfdaa1415cdde005cc43267d0",
"rev": "9ef7297ef142354ace8b1f3f277d0eee3cfdc6d4",
"type": "github"
},
"original": {
@ -575,11 +574,11 @@
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1676390054,
"narHash": "sha256-w0KvrM+9WIEYr0juDh4Vs39ed2IaT0T696fp9pZ7i1I=",
"lastModified": 1678313833,
"narHash": "sha256-HUkOzLVYDTYzxH4zMeR2JIrh1zY/n3LIs8rtNnKeOTA=",
"owner": "oxalica",
"repo": "nil",
"rev": "944d5c335531778a1d7b54a97bf7fb5ec0c3e976",
"rev": "d1017418841c612552f73d1f670d87f57dc5e090",
"type": "github"
},
"original": {
@ -654,11 +653,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1677063315,
"narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=",
"lastModified": 1658161305,
"narHash": "sha256-X/nhnMCa1Wx4YapsspyAs6QYz6T/85FofrI6NpdPDHg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "988cc958c57ce4350ec248d2d53087777f9e1949",
"rev": "e4d49de45a3b5dbcb881656b4e3986e666141ea9",
"type": "github"
},
"original": {
@ -670,11 +669,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1677063315,
"narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=",
"lastModified": 1677676435,
"narHash": "sha256-6FxdcmQr5JeZqsQvfinIMr0XcTyTuR7EXX0H3ANShpQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "988cc958c57ce4350ec248d2d53087777f9e1949",
"rev": "a08d6979dd7c82c4cef0dcc6ac45ab16051c1169",
"type": "github"
},
"original": {
@ -686,11 +685,11 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1677063315,
"narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=",
"lastModified": 1674641431,
"narHash": "sha256-qfo19qVZBP4qn5M5gXc/h1MDgAtPA5VxJm9s8RUAkVk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "988cc958c57ce4350ec248d2d53087777f9e1949",
"rev": "9b97ad7b4330aacda9b2343396eb3df8a853b4fc",
"type": "github"
},
"original": {
@ -718,11 +717,11 @@
},
"nixpkgs_7": {
"locked": {
"lastModified": 1677142198,
"narHash": "sha256-Y/uC2ZmkQkyrdRZ5szZilhZ/46786Wio5CGTgL+Vb/c=",
"lastModified": 1678298120,
"narHash": "sha256-iaV5xqgn29xy765Js3EoZePQyZIlLZA3pTYtTnKkejg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "03fb72201639e5274fee6d77b0d9c66e98329aba",
"rev": "1e383aada51b416c6c27d4884d2e258df201bc11",
"type": "github"
},
"original": {
@ -826,11 +825,11 @@
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1677160285,
"narHash": "sha256-tBzpCjMP+P3Y3nKLYvdBkXBg3KvTMo3gvi8tLQaqXVY=",
"lastModified": 1677832802,
"narHash": "sha256-XQf+k6mBYTiQUjWRf/0fozy5InAs03O1b30adCpWeXs=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "2bd861ab81469428d9c823ef72c4bb08372dd2c4",
"rev": "382bee738397ca005206eefa36922cc10df8a21c",
"type": "github"
},
"original": {
@ -905,11 +904,11 @@
]
},
"locked": {
"lastModified": 1675391458,
"narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=",
"lastModified": 1677638104,
"narHash": "sha256-vbdOoDYnQ1QYSchMb3fYGCLYeta3XwmGvMrlXchST5s=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf",
"rev": "f388187efb41ce4195b2f4de0b6bb463d3cd0a76",
"type": "github"
},
"original": {
@ -921,11 +920,11 @@
"smartcolumn-nvim": {
"flake": false,
"locked": {
"lastModified": 1677125264,
"narHash": "sha256-Om0t759e6JYwcg6V+HdJk59h2yVt9kPLwGBMKNnP8AA=",
"lastModified": 1677732751,
"narHash": "sha256-uu9h5Pjw05IokTbJxrVlavZXpm3Ny6jrmhcHXzvwngU=",
"owner": "m4xshen",
"repo": "smartcolumn.nvim",
"rev": "1202b0741b87b0815bdc6fc6ebacb2df9e6628ee",
"rev": "6e16c7d1b5e8bf4cb7ddcab5c91745190e80e99d",
"type": "github"
},
"original": {
@ -936,11 +935,11 @@
},
"stable": {
"locked": {
"lastModified": 1677075010,
"narHash": "sha256-X+UmR1AkdR//lPVcShmLy8p1n857IGf7y+cyCArp8bU=",
"lastModified": 1678230755,
"narHash": "sha256-SFAXgNjNTXzcAideXcP0takfUGVft/VR5CACmYHg+Fc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c95bf18beba4290af25c60cbaaceea1110d0f727",
"rev": "a7cc81913bb3cd1ef05ed0ece048b773e1839e51",
"type": "github"
},
"original": {
@ -974,11 +973,11 @@
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1675374853,
"narHash": "sha256-BSrjNcddYWhFUMtjGwxiEXw67MYRaIHGvLn19Mvm1NE=",
"lastModified": 1677789111,
"narHash": "sha256-dWrk+Q3bLdtFe5rkyaAKWCQJCeE/KFNllcu1DvBC38c=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "677a3f2f8847ed2de49dd60868f9d9487a546f58",
"rev": "5ae17de23f5fd9bb252a698f3771c840280e2c05",
"type": "gitlab"
},
"original": {

View file

@ -104,11 +104,17 @@
channelsConfig.allowUnfree = true;
lib = nixpkgs.lib.extend
(self: super: { my = import ./lib { lib = self; }; });
################
### Overlays ###
################
overlay = import ./overlays { inherit inputs; };
overlay = import ./overlays {
inherit inputs;
inherit (self) lib;
};
channels.nixpkgs.overlaysBuilder = channels: [
inputs.emacs.overlays.default
@ -135,8 +141,8 @@
./modules/profiles/desktop.nix
./modules/profiles/work.nix
];
hostDefaults.modules = [
hostDefaults = {
modules = [
./modules/default.nix
self.nixosModules.base
inputs.home-manager.nixosModule
@ -151,6 +157,7 @@
inputs.agenix.nixosModules.age
inputs.howdy.nixosModules.default
];
};
hosts.nixos-laptop.modules = [
./hosts/nixos-laptop

16
lib/default.nix Normal file
View file

@ -0,0 +1,16 @@
{ lib, ... }:
lib.makeExtensible (self: rec {
mkDate = longDate: lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
];
mkVersionSrc = src: "unstable-" + builtins.substring 0 7 src.rev;
mkVersionInput = input:
let
date = mkDate (input.lastModifiedDate or "19700101");
rev = input.shortRev or "dirty";
in
"unstable-${date}_${rev}";
})

View file

@ -63,7 +63,6 @@ in
fish.enable = true;
git.enable = true;
gpg.enable = true;
vim.enable = true;
};
};
@ -105,6 +104,7 @@ in
up
viu
wget
vim
];
fonts.fonts = with pkgs; [

View file

@ -21,7 +21,6 @@ with lib; {
adb.enable = true;
hyprland.enable = true;
code.enable = true;
emacs.enable = true;
firefox = {
enable = true;
arkenfox = {
@ -77,6 +76,7 @@ with lib; {
hub.enable = true;
ledger.enable = true;
logseq.enable = true;
nvim.enable = true;
python.versions."311".enable = true;
ssh = {
enable = true;
@ -103,7 +103,7 @@ with lib; {
# ripping
abcde
stable.handbrake # HACK to fix broken ffmpeg on unstable
handbrake
picard
# other

View file

@ -34,7 +34,7 @@ with lib; {
};
spotify.enable = true;
thunar.enable = true;
vim.enable = true;
nvim.enable = true;
zathura.enable = true;
};

View file

@ -7,16 +7,17 @@
with lib;
let
cfg = config.my.programs.vim;
cfg = config.my.programs.nvim;
mkPlugin = name: {
plugin = pkgs.vimPlugins.${name};
type = "lua";
config = lib.readFile (./plugins + "/${name}.lua");
};
in
{
options.my.programs.vim = {
enable = mkOption {
default = true;
type = types.bool;
example = false;
};
};
options.my.programs.nvim.enable = mkEnableOption "nvim";
config = mkIf cfg.enable {
home-manager.users.moritz = {
@ -50,46 +51,50 @@ in
taplo
yamlfmt
];
plugins = with pkgs.vimPlugins; [
catppuccin-nvim
plugins = builtins.map mkPlugin [
"catppuccin-nvim"
"comment-nvim"
"copilot-lua"
"dashboard-nvim"
"formatter-nvim"
"gitsigns-nvim"
"lualine-nvim"
"noice-nvim"
"nvim-autopairs"
"nvim-lastplace"
"nvim-surround"
"nvim-tree-lua"
"nvim-treesitter-textsubjects"
"nvim-ts-context-commentstring"
"orgmode"
"smartcolumn-nvim"
"telescope-fzf-native-nvim"
"telescope-nvim"
"telescope-zoxide"
"which-key-nvim"
"todo-comments-nvim"
] ++ (with pkgs.vimPlugins; [
cmp-nvim-lsp
cmp_luasnip
comment-nvim
copilot-cmp
copilot-lua
dashboard-nvim
direnv-vim
formatter-nvim
gitsigns-nvim
impatient-nvim
lsp_lines-nvim
lspkind-nvim
lspsaga-nvim-original
lualine-lsp-progress
lualine-nvim
luasnip
neogit
noice-nvim
nui-nvim # for noice-nvim
nvim-autopairs
nvim-cmp
nvim-lastplace
nvim-lspconfig
nvim-surround
nvim-tree-lua
nvim-treesitter-textsubjects
nvim-treesitter.withAllGrammars
nvim-ts-context-commentstring
nvim-ufo
nvim-web-devicons # for dashboard-nvim
orgmode
plenary-nvim # for telescope, neogit
popup-nvim
smartcolumn-nvim
telescope-fzf-native-nvim
telescope-nvim
telescope-zoxide
promise-async
vim-lion
which-key-nvim
];
]);
};
};
};

View file

@ -8,7 +8,7 @@ if not vim.loop.fs_stat(spelldir) then
end
vim.opt.autoindent = true
vim.opt.backupdir = { vim.fn.stdpath("state") .. "/nvim/backup//" } -- don't store backup in files dir
vim.opt.backupdir = { vim.fn.stdpath("state") .. "/nvim/backup/" } -- don't store backup in files dir
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
vim.opt.conceallevel = 2
vim.opt.expandtab = true -- spaces instead of tabs
@ -37,78 +37,29 @@ if vim.g.neovide then
vim.g.neovide_scale_factor = 0.7
end
require("catppuccin").setup({
compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store
integrations = {
which_key = true,
},
})
vim.cmd.colorscheme("catppuccin-macchiato")
require("impatient")
vim.o.timeout = true
vim.o.timeoutlen = 500
local wk = require("which-key")
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,
},
progress = {
enabled = false,
},
},
-- 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 = false, -- add a border to hover docs and signature help
},
})
require("telescope").load_extension("zoxide")
wk.register({
f = {
name = "find",
f = { "<cmd>Telescope find_files<cr>", "find file" },
z = { "<cmd>Telescope zoxide list<cr>", "find location" },
l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "find line" },
g = { "<cmd>Telescope live_grep<cr>", "live grep" },
b = { "<cmd>Telescope buffers<cr>", "find buffer" },
},
}, { prefix = "<leader>" })
-- To get fzf loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require("telescope").load_extension("fzf")
require("neogit").setup({
disable_commit_confirmation = true,
})
wk.register({
g = { "<cmd>Neogit<cr>", "git" },
}, { prefix = "<leader>" })
require("nvim-treesitter.configs").setup({
sync_install = false,
auto_install = false,
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
additional_vim_regex_highlighting = false,
},
})
local lspkind = require("lspkind")
-- load cmp on InsertEnter
vim.api.nvim_create_autocmd("InsertEnter", {
callback = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
require("copilot_cmp").setup()
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
cmp.setup({
formatting = {
format = lspkind.cmp_format({
format = require("lspkind").cmp_format({
mode = "symbol", -- show only symbol annotations
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
@ -155,6 +106,8 @@ cmp.setup({
{ name = "nvim_lsp", priority = 9 },
{ name = "orgmode", priority = 9 },
},
})
end,
})
---merge tables
@ -185,76 +138,6 @@ local function table_merge(...)
return result
end
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
require("formatter").setup({
-- Enable or disable logging
logging = true,
-- Set the log level
log_level = vim.log.levels.WARN,
-- All formatter configurations are opt-in
filetype = {
json = {
require("formatter.filetypes.json").jq,
},
lua = {
require("formatter.filetypes.lua").stylua,
},
nix = {
require("formatter.filetypes.nix").nixpkgs_fmt,
},
python = {
require("formatter.filetypes.python").black,
},
rust = {
require("formatter.filetypes.rust").rustfmt,
},
sh = {
require("formatter.filetypes.sh").shfmt,
},
toml = {
require("formatter.filetypes.toml").taplo,
},
yaml = {
require("formatter.filetypes.yaml").yamlfmt,
},
-- HACK to use specific formatters only when specified
alejandra = {
require("formatter.filetypes.nix").alejandra,
},
isort = {
require("formatter.filetypes.python").isort,
},
-- Use the special "*" filetype for defining formatter configurations on
-- any filetype
["*"] = {
-- "formatter.filetypes.any" defines default configurations for any
-- filetype
require("formatter.filetypes.any").remove_trailing_whitespace,
},
},
})
vim.api.nvim_create_user_command("Fmt", function(opts)
local params = vim.split(opts.args, "%s+", { trimempty = true })
local filetype = vim.bo.filetype
vim.cmd("set filetype=" .. params[1]) -- fake filetype
vim.cmd(":Format")
vim.cmd("set filetype=" .. filetype) -- restore original filetype
end, {
nargs = 1,
complete = function()
local languages = {
nix = { "alejandra" },
python = { "isort" },
}
return languages[vim.bo.filetype] or {}
end,
})
wk.register({
["="] = { "<cmd>Format<cr>", "format (formatter)" },
}, { noremap = true, silent = true })
local lsp_lines = require("lsp_lines")
lsp_lines.setup()
-- Disable virtual_text since it's redundant due to lsp_lines.
@ -265,10 +148,64 @@ vim.diagnostic.config({
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require("cmp_nvim_lsp").default_capabilities()
vim.o.foldcolumn = "1" -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
vim.o.statuscolumn = "%= "
-- FIXME: figure out how to put on the other side without having to do a lot of shifting
.. "%s" -- sign column
.. "%{%" -- evaluate this, and then evaluate what it returns
.. "&number ?"
.. "(v:relnum ?"
-- when showing relative numbers, make sure to pad so things don't shift as you move the cursor
.. 'printf("%"..len(line("$")).."s", v:relnum)'
.. ":"
.. "v:lnum"
.. ")"
.. ":"
.. '""'
.. " " -- space between lines and fold
.. "%}"
.. "%= "
.. "%#FoldColumn#" -- highlight group for fold
.. "%{" -- expression for showing fold expand/colapse
.. "foldlevel(v:lnum) > foldlevel(v:lnum - 1)" -- any folds?
.. "? (foldclosed(v:lnum) == -1" -- currently open?
.. '? ""' -- point down
.. ': ""' -- point to right
.. ")"
.. ': " "' -- blank for no fold, or inside fold
.. "}"
.. "%= " -- spacing between end of column and start of text
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
wk.register({
z = {
R = { require("ufo").openAllFolds, "Open all folds" },
M = { require("ufo").closeAllFolds, "Close all folds" },
},
})
-- Tell the server the capability of foldingRange,
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
require("ufo").setup()
require("lspsaga").setup({
symbol_in_winbar = {
enable = false,
},
lightbulb = {
enable = true,
enable_in_insert = true,
sign = true,
sign_priority = 40,
virtual_text = false,
},
})
local lspconfig = require("lspconfig")
@ -340,8 +277,6 @@ for _, lsp in ipairs(servers) do
end
lspconfig_setup("lua_ls", {
on_attach = on_attach_def,
capabilities = capabilities,
settings = {
Lua = {
runtime = {
@ -367,131 +302,3 @@ lspconfig_setup("lua_ls", {
},
},
})
require("dashboard").setup({
theme = "hyper",
config = {
packages = { enable = false },
week_header = {
enable = true,
},
},
})
require("lualine").setup({
options = {
icons_enabled = true,
theme = "auto",
component_separators = "|",
section_separators = { left = "", right = "" },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = {
{ "mode", separator = { left = "" }, right_padding = 2 },
},
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename", "lsp_progress" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = {
{ "location", separator = { right = "" }, left_padding = 2 },
},
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {},
})
require("Comment").setup()
require("nvim-treesitter.configs").setup({
context_commentstring = {
enable = true,
},
})
require("nvim-surround").setup({})
require("nvim-treesitter.configs").setup({
textsubjects = {
enable = true,
prev_selection = ",", -- (Optional) keymap to select the previous selection
keymaps = { ["."] = "textsubjects-smart" },
},
})
require("copilot").setup({
suggestion = { enabled = false },
panel = { enabled = false },
})
vim.api.nvim_create_autocmd("VimEnter", {
desc = "Disable Copilot by default on startup",
command = "Copilot disable",
})
require("copilot_cmp").setup()
local orgmode = require("orgmode")
-- Load custom treesitter grammar for org filetype
orgmode.setup_ts_grammar()
-- Treesitter configuration
require("nvim-treesitter.configs").setup({
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
-- highlighting will fallback to default Vim syntax highlighting
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { "org" },
},
})
orgmode.setup({
org_agenda_files = { "~/Notes/org" },
org_default_notes_file = "~/Notes/org/refile.org",
})
require("gitsigns").setup()
require("nvim-lastplace").setup({
lastplace_ignore_buftype = { "quickfix", "nofile", "help" },
lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" },
lastplace_open_folds = true,
})
require("nvim-autopairs").setup()
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
-- empty setup using defaults
require("nvim-tree").setup()
wk.register({
t = { "<cmd>NvimTreeFindFileToggle<cr>", "nvim tree" },
}, { prefix = "<leader>t", silent = true })
require("smartcolumn").setup({
colorcolumn = 120,
disabled_filetypes = { "help", "text", "markdown", "dashboard" },
})

View file

@ -0,0 +1,7 @@
require("catppuccin").setup({
compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store
integrations = {
which_key = true,
},
})
vim.cmd.colorscheme("catppuccin-macchiato")

View file

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

View file

@ -0,0 +1,8 @@
require("copilot").setup({
suggestion = { enabled = false },
panel = { enabled = false },
})
vim.api.nvim_create_autocmd("VimEnter", {
desc = "Disable Copilot by default on startup",
command = "Copilot disable",
})

View file

@ -0,0 +1,9 @@
require("dashboard").setup({
theme = "hyper",
config = {
packages = { enable = false },
week_header = {
enable = true,
},
},
})

View file

@ -0,0 +1,71 @@
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
require("formatter").setup({
-- Enable or disable logging
logging = true,
-- Set the log level
log_level = vim.log.levels.WARN,
-- All formatter configurations are opt-in
filetype = {
json = {
require("formatter.filetypes.json").jq,
},
lua = {
require("formatter.filetypes.lua").stylua,
},
nix = {
require("formatter.filetypes.nix").nixpkgs_fmt,
},
python = {
require("formatter.filetypes.python").black,
},
rust = {
require("formatter.filetypes.rust").rustfmt,
},
sh = {
require("formatter.filetypes.sh").shfmt,
},
toml = {
require("formatter.filetypes.toml").taplo,
},
yaml = {
require("formatter.filetypes.yaml").yamlfmt,
},
-- HACK to use specific formatters only when specified
alejandra = {
require("formatter.filetypes.nix").alejandra,
},
isort = {
require("formatter.filetypes.python").isort,
},
-- Use the special "*" filetype for defining formatter configurations on
-- any filetype
["*"] = {
-- "formatter.filetypes.any" defines default configurations for any
-- filetype
require("formatter.filetypes.any").remove_trailing_whitespace,
},
},
})
vim.api.nvim_create_user_command("Fmt", function(opts)
local params = vim.split(opts.args, "%s+", { trimempty = true })
local filetype = vim.bo.filetype
vim.cmd("set filetype=" .. params[1]) -- fake filetype
vim.cmd(":Format")
vim.cmd("set filetype=" .. filetype) -- restore original filetype
end, {
nargs = 1,
complete = function()
local languages = {
nix = { "alejandra" },
python = { "isort" },
}
return languages[vim.bo.filetype] or {}
end,
})
require("which-key").register({
["="] = { "<cmd>Format<cr>", "format (formatter)" },
}, { noremap = true, silent = true })

View file

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

View file

@ -0,0 +1,44 @@
require("lualine").setup({
options = {
icons_enabled = true,
theme = "auto",
component_separators = "|",
section_separators = { left = "", right = "" },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = {
{ "mode", separator = { left = "" }, right_padding = 2 },
},
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename", "lsp_progress" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = {
{ "location", separator = { right = "" }, left_padding = 2 },
},
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {},
})

View file

@ -0,0 +1,21 @@
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,
},
progress = {
enabled = false,
},
},
-- 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 = false, -- add a border to hover docs and signature help
},
})

View file

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

View file

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

View file

@ -0,0 +1 @@
require("nvim-surround").setup({})

View file

@ -0,0 +1,10 @@
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
-- empty setup using defaults
require("nvim-tree").setup()
require("which-key").register({
t = { "<cmd>NvimTreeFindFileToggle<cr>", "nvim tree" },
}, { prefix = "<leader>t", silent = true })

View file

@ -0,0 +1,7 @@
require("nvim-treesitter.configs").setup({
textsubjects = {
enable = true,
prev_selection = ",", -- (Optional) keymap to select the previous selection
keymaps = { ["."] = "textsubjects-smart" },
},
})

View file

@ -0,0 +1,5 @@
require("nvim-treesitter.configs").setup({
context_commentstring = {
enable = true,
},
})

View file

@ -0,0 +1,18 @@
local orgmode = require("orgmode")
-- Load custom treesitter grammar for org filetype
orgmode.setup_ts_grammar()
-- Treesitter configuration
require("nvim-treesitter.configs").setup({
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
-- highlighting will fallback to default Vim syntax highlighting
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { "org" },
},
})
orgmode.setup({
org_agenda_files = { "~/Notes/org" },
org_default_notes_file = "~/Notes/org/refile.org",
})

View file

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

View file

@ -0,0 +1 @@
require("telescope").load_extension("fzf")

View file

@ -0,0 +1,9 @@
require("which-key").register({
f = {
name = "find",
f = { "<cmd>Telescope find_files<cr>", "find file" },
l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "find line" },
g = { "<cmd>Telescope live_grep<cr>", "live grep" },
b = { "<cmd>Telescope buffers<cr>", "find buffer" },
},
}, { prefix = "<leader>" })

View file

@ -0,0 +1,7 @@
require("telescope").load_extension("zoxide")
require("which-key").register({
f = {
name = "find",
z = { "<cmd>Telescope zoxide list<cr>", "find location" },
},
}, { prefix = "<leader>" })

View file

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

View file

@ -0,0 +1,2 @@
vim.o.timeout = true
vim.o.timeoutlen = 500

12
overlays/channels.nix Normal file
View file

@ -0,0 +1,12 @@
{ lib, inputs }:
final: prev: {
master = import inputs.master {
inherit (prev) system;
config.allowUnfree = true;
};
stable = import inputs.stable {
inherit (prev) system;
config.allowUnfree = true;
};
}

View file

@ -1,81 +1,9 @@
{ inputs }: final: prev:
let
mkDate = longDate: (prev.lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
mkVersionSrc = src: "unstable-" + builtins.substring 0 7 src.rev;
mkVersionInput = input: "unstable-" + mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty");
in
{
agenix = inputs.agenix.packages.${prev.system}.default;
attic = inputs.attic.packages.${prev.system}.default;
hyprpaper = inputs.hyprpaper.packages.${prev.system}.default;
neovim-nightly = inputs.neovim.packages.${prev.system}.default;
nil = inputs.nil.packages.${prev.system}.default;
{ inputs, lib }:
logseq-wayland = prev.symlinkJoin {
name = "logseq-wayland";
paths = [ prev.logseq ];
nativeBuildInputs = [ prev.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/logseq \
--add-flags "--socket=wayland --enable-features=UseOzonePlatform --ozone-platform=wayland"
'';
};
waybar-hyprland = prev.waybar.overrideAttrs (old: {
pname = "${old.pname}-hyprland";
postPatch = old.postPatch or "" + ''
sed -i 's,zext_workspace_handle_v1_activate(workspace_handle_);,const std::string command = "${final.hyprland}/bin/hyprctl dispatch workspace " + name_;\n\tsystem(command.c_str());,g' src/modules/wlr/workspace_manager.cpp
'';
mesonFlags = old.mesonFlags or [ ] ++ [ "-Dexperimental=true" ];
});
vimPlugins = prev.vimPlugins // {
nvim-treesitter-textsubjects = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter-textsubjects";
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
src = inputs.nvim-treesitter-textsubjects;
};
smartcolumn-nvim = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim;
src = inputs.smartcolumn-nvim;
};
copilot-lua = prev.vimPlugins.copilot-lua.overrideAttrs (old: {
version = mkVersionInput inputs.copilot-lua;
src = inputs.copilot-lua;
});
lspsaga-nvim-original = prev.vimPlugins.lspsaga-nvim-original.overrideAttrs (old: {
version = mkVersionInput inputs.lspsaga-nvim;
src = inputs.lspsaga-nvim;
});
};
neovide-hyprland = final.symlinkJoin {
name = "neovide-hyprland-${final.neovide.version}";
paths = [ final.neovide ];
nativeBuildInputs = [ final.makeWrapper ];
postBuild = ''
rm $out/bin/neovide
makeWrapper ${final.neovide}/bin/neovide $out/bin/neovide --set WINIT_UNIX_BACKEND x11
'';
meta = final.neovide.meta // {
mainProgram = "neovide";
};
};
master = import inputs.master {
inherit (prev) system;
config.allowUnfree = true;
};
stable = import inputs.stable {
inherit (prev) system;
config.allowUnfree = true;
};
}
lib.composeManyExtensions [
(import ./channels.nix { inherit inputs lib; })
(import ./packages.nix { inherit inputs lib; })
(import ./vimPlugins.nix { inherit inputs lib; })
(import ./wayland.nix { inherit inputs lib; })
(import ./lib.nix { inherit inputs lib; })
]

5
overlays/lib.nix Normal file
View file

@ -0,0 +1,5 @@
{ lib, inputs }:
final: prev: {
inherit lib;
}

10
overlays/packages.nix Normal file
View file

@ -0,0 +1,10 @@
{ inputs, lib }:
final: prev:
{
agenix = inputs.agenix.packages.${prev.system}.default;
attic = inputs.attic.packages.${prev.system}.default;
hyprpaper = inputs.hyprpaper.packages.${prev.system}.default;
neovim-nightly = inputs.neovim.packages.${prev.system}.default;
nil = inputs.nil.packages.${prev.system}.default;
}

29
overlays/vimPlugins.nix Normal file
View file

@ -0,0 +1,29 @@
{ inputs, lib }:
final: prev:
with lib.my;
{
vimPlugins = prev.vimPlugins // {
nvim-treesitter-textsubjects = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter-textsubjects";
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
src = inputs.nvim-treesitter-textsubjects;
};
smartcolumn-nvim = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim;
src = inputs.smartcolumn-nvim;
};
copilot-lua = prev.vimPlugins.copilot-lua.overrideAttrs (old: {
version = mkVersionInput inputs.copilot-lua;
src = inputs.copilot-lua;
});
lspsaga-nvim-original = prev.vimPlugins.lspsaga-nvim-original.overrideAttrs (old: {
version = mkVersionInput inputs.lspsaga-nvim;
src = inputs.lspsaga-nvim;
});
};
}

33
overlays/wayland.nix Normal file
View file

@ -0,0 +1,33 @@
{ lib, inputs }:
final: prev: {
neovide-hyprland = final.symlinkJoin {
name = "neovide-hyprland-${final.neovide.version}";
paths = [ final.neovide ];
nativeBuildInputs = [ final.makeWrapper ];
postBuild = ''
rm $out/bin/neovide
makeWrapper ${final.neovide}/bin/neovide $out/bin/neovide --set WINIT_UNIX_BACKEND x11
'';
meta = final.neovide.meta // {
mainProgram = "neovide";
};
};
logseq-wayland = prev.symlinkJoin {
name = "logseq-wayland";
paths = [ prev.logseq ];
nativeBuildInputs = [ prev.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/logseq \
--add-flags "--socket=wayland --enable-features=UseOzonePlatform --ozone-platform=wayland"
'';
};
waybar-hyprland = prev.waybar.overrideAttrs (old: {
pname = "${old.pname}-hyprland";
postPatch = old.postPatch or "" + ''
sed -i 's,zext_workspace_handle_v1_activate(workspace_handle_);,const std::string command = "${final.hyprland}/bin/hyprctl dispatch workspace " + name_;\n\tsystem(command.c_str());,g' src/modules/wlr/workspace_manager.cpp
'';
mesonFlags = old.mesonFlags or [ ] ++ [ "-Dexperimental=true" ];
});
}