Compare commits

..

3 Commits

15 changed files with 707 additions and 369 deletions

View File

@ -70,11 +70,11 @@
]
},
"locked": {
"lastModified": 1683433501,
"narHash": "sha256-9L+OZeU3bcNZ55mhMINBxnqskbaEU0mhiZIMhkEtNl0=",
"lastModified": 1685309025,
"narHash": "sha256-pZxMM3AMP/ojwhrFD0A2ML4NOgehlBLGHseInnO5evc=",
"owner": "zhaofengli",
"repo": "attic",
"rev": "5f85e35a25085b75e1cbb6cc7291726fa4fab2ed",
"rev": "b1fb790b5f2afaaa1b2f7f18979b8318abe604bb",
"type": "github"
},
"original": {
@ -102,11 +102,11 @@
"copilot-lua": {
"flake": false,
"locked": {
"lastModified": 1683572689,
"narHash": "sha256-+dqwwBHDRh1vmbgx8o1RVMEAN7Hlr5I5L71wdagDo/o=",
"lastModified": 1685261869,
"narHash": "sha256-jBTS8MeN7Ydf0ZY7JWbrxaGo/GeDoEClfULiJVfN8Wo=",
"owner": "zbirenbaum",
"repo": "copilot.lua",
"rev": "653bbdc44cd569a5fd0617e5a9d3df2b1359e230",
"rev": "77e3a4907928f0813024e573b882dc879dfc0c6b",
"type": "github"
},
"original": {
@ -255,11 +255,11 @@
]
},
"locked": {
"lastModified": 1683560683,
"narHash": "sha256-XAygPMN5Xnk/W2c1aW0jyEa6lfMDZWlQgiNtmHXytPc=",
"lastModified": 1685662779,
"narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "006c75898cf814ef9497252b022e91c946ba8e17",
"rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3",
"type": "github"
},
"original": {
@ -273,11 +273,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1678379998,
"narHash": "sha256-TZdfNqftHhDuIFwBcN9MUThx5sQXCTeZk9je5byPKRw=",
"lastModified": 1685546676,
"narHash": "sha256-XDbjJyAg6odX5Vj0Q22iI/gQuFvEkv9kamsSbQ+npaI=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c13d60b89adea3dc20704c045ec4d50dd964d447",
"rev": "6ef2707776c6379bc727faf3f83c0dd60b06e0c6",
"type": "github"
},
"original": {
@ -295,11 +295,11 @@
]
},
"locked": {
"lastModified": 1678379998,
"narHash": "sha256-TZdfNqftHhDuIFwBcN9MUThx5sQXCTeZk9je5byPKRw=",
"lastModified": 1680392223,
"narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c13d60b89adea3dc20704c045ec4d50dd964d447",
"rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5",
"type": "github"
},
"original": {
@ -313,11 +313,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
@ -418,16 +418,16 @@
},
"haskell-flake": {
"locked": {
"lastModified": 1678138103,
"narHash": "sha256-D0lao82bV3t2gEFjHiU6RN233t+1MnkQV+bq8MEu2ic=",
"owner": "hercules-ci",
"lastModified": 1678745009,
"narHash": "sha256-ujfwSrkxThmHJozibkCnJmlXLVyxm+Cbo2Q4wXPbCS4=",
"owner": "srid",
"repo": "haskell-flake",
"rev": "1e1660e6dd00838ba73bc7952e6e73be67da18d1",
"rev": "26852ade574c712bc3912ad28de52b0c4cf7d4cb",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"ref": "0.1-extraLibraries",
"owner": "srid",
"ref": "0.2.0",
"repo": "haskell-flake",
"type": "github"
}
@ -441,11 +441,11 @@
"pre-commit-hooks-nix": "pre-commit-hooks-nix"
},
"locked": {
"lastModified": 1678446614,
"narHash": "sha256-Z6Gsba5ahn/N0QlF0vJfIEfnZgCs4qr1IZtXAqjbE7s=",
"lastModified": 1681758488,
"narHash": "sha256-RBd/RNq3wL52FvoajMwrnfyZPfq67KMzmp6rtNAx/2o=",
"owner": "hercules-ci",
"repo": "hercules-ci-agent",
"rev": "0b90d1a87c117a5861785cb85833dd1c9df0b6ef",
"rev": "ef296dd6211e2ffeb942f12e6232a2d9abdd488d",
"type": "github"
},
"original": {
@ -463,11 +463,11 @@
]
},
"locked": {
"lastModified": 1681898675,
"narHash": "sha256-nIJ7CAdiHv4i1no/VgDoeTJLzbLYwu5+/Ycoyzn0S78=",
"lastModified": 1685557007,
"narHash": "sha256-0prbgwFJeBuLGJgNdOXCXQ8/oSamzkcNZYHr04ZXI2I=",
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"rev": "15ff4f63e5f28070391a5b09a82f6d5c6cc5c9d0",
"rev": "6d8e62977dc34fd2c187879856ebb6cf1faabba9",
"type": "github"
},
"original": {
@ -504,11 +504,11 @@
]
},
"locked": {
"lastModified": 1684824189,
"narHash": "sha256-k3nCkn5Qy67rCguuw6YkGuL6hOUNRKxQoKOjnapk5sU=",
"lastModified": 1685721552,
"narHash": "sha256-ifvq/zlO7lck8q+YkC5uom/h8/MVdMcQEldOL3cDQW0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "58eb968c21d309a6c2b020ea8d64e25c38ceebba",
"rev": "29519461834c08395b35f840811faf8c23e3b61c",
"type": "github"
},
"original": {
@ -543,11 +543,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1684844798,
"narHash": "sha256-ZrMXFoEA535jOZ+eDA3s+URZ5MkVRksBgL5qGnb6Ciw=",
"lastModified": 1685729674,
"narHash": "sha256-i5+/bAZVmCbeIKmnwyd2DG3mGrP4LOJWbsU7nJ1lzuA=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "eb1f832fcec5838053c6b031b656e4f949ada57b",
"rev": "871ab24c6e9d2fb6e48cbf990ddddf0c46a950af",
"type": "github"
},
"original": {
@ -564,11 +564,11 @@
]
},
"locked": {
"lastModified": 1681065697,
"narHash": "sha256-QPzwwlGKX95tl6ZEshboZbEwwAXww6lNLdVYd6T9Mrc=",
"lastModified": 1684265364,
"narHash": "sha256-AxNnWbthsuNx73HDQr0eBxrcE3+yfl/WsaXZqUFmkpQ=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "4d29e48433270a2af06b8bc711ca1fe5109746cd",
"rev": "8c279b9fb0f2b031427dc5ef4eab53f2ed835530",
"type": "github"
},
"original": {
@ -582,11 +582,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1684265311,
"narHash": "sha256-zFOShOYS7zMcyCT9bFQlWB/ZtTelAFKKGUq4XBRQLE0=",
"lastModified": 1685378141,
"narHash": "sha256-/ehJbAtSJS86NlqHVOeR2ViBKlImKH4guFVPacTmCr8=",
"owner": "hyprwm",
"repo": "hyprpaper",
"rev": "b82254e957cfa60124240e8d94e7368cbf6d392d",
"rev": "cd86c196f3500f20539754d347c8378349ca0974",
"type": "github"
},
"original": {
@ -614,11 +614,11 @@
"lspsaga-nvim": {
"flake": false,
"locked": {
"lastModified": 1684482876,
"narHash": "sha256-ETT0HPLTA6ZO2C51+YXQ2PTkol61Azzn9FhLhmObrr8=",
"lastModified": 1685612219,
"narHash": "sha256-Cr4BAAMX0SEPM51JejjnhOUXigMIGvyzqFYYAZ426bU=",
"owner": "glepnir",
"repo": "lspsaga.nvim",
"rev": "01b9633aefd010f272d6c7e3d8293c44fcfe7696",
"rev": "c475ace5b8882631b351ef7c3e8078ca9ebbb751",
"type": "github"
},
"original": {
@ -629,11 +629,11 @@
},
"master": {
"locked": {
"lastModified": 1684857135,
"narHash": "sha256-MrX+6QO3xf+Gkm+BgU45jBB/l9XRvH/hGsLfx8fEetU=",
"lastModified": 1685770779,
"narHash": "sha256-cJd4Bf0jUOG/l/k9I83IYsq9jDFPyLAfiIw1cjErcTU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "499cad7a722caf0bebb2a382a67fa39c992acebd",
"rev": "f04dbdd29e954e51e98d2a0896c13180f5247143",
"type": "github"
},
"original": {
@ -652,11 +652,11 @@
},
"locked": {
"dir": "contrib",
"lastModified": 1684757802,
"narHash": "sha256-Uo8HJ5j33mzgfrpK2zo0N/vgzTFG8KhMBE4+M1C9oCo=",
"lastModified": 1685727707,
"narHash": "sha256-qxmSnNjRxXuFfPNaDMnTPjn8890CN2EQ1Il8XVJhkKE=",
"owner": "neovim",
"repo": "neovim",
"rev": "07883940b2294e0ab32fb58e6624d18d9dd1715a",
"rev": "a8ee4c7a81a8df3fe705e941e7d1c2c9e2f6194e",
"type": "github"
},
"original": {
@ -675,11 +675,11 @@
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1684800319,
"narHash": "sha256-cyR9g1WSX1WCPGOgL/JXjzwir0Db7k9WMWfwuMgMl5w=",
"lastModified": 1685750689,
"narHash": "sha256-ylsh7ELjDc4jHCBZgUVTD08aTD31SpXoqXnjlbGdyoQ=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "1d9dcda97f8d16214821ace2cf92f61f1cc348c3",
"rev": "b9c2089d1936a81d466de8a2ccb9d75c22b5b7fd",
"type": "github"
},
"original": {
@ -699,11 +699,11 @@
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1684534870,
"narHash": "sha256-QrOkY6Ei/7FZg50Ht8iC9ryqrQyBzjtnSQoftL8ZNNc=",
"lastModified": 1685532165,
"narHash": "sha256-xHH9WbE9uya2B+j5w82HzpZVeErBt03/jtmWVRox0EU=",
"owner": "oxalica",
"repo": "nil",
"rev": "17ed1578f3a225f2760d4da3adb440eb8677f2d3",
"rev": "dcd38b96c91a2d07552f824a6480e00dc7b4948a",
"type": "github"
},
"original": {
@ -722,11 +722,11 @@
]
},
"locked": {
"lastModified": 1673295039,
"narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=",
"lastModified": 1680266963,
"narHash": "sha256-IW/lzbUCOcldLHWHjNSg1YoViDnZOmz0ZJL7EH9OkV8=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "87b9d090ad39b25b2400029c64825fc2a8868943",
"rev": "99d4187d11be86b49baa3a1aec0530004072374f",
"type": "github"
},
"original": {
@ -778,11 +778,11 @@
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1678375444,
"narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=",
"lastModified": 1682879489,
"narHash": "sha256-sASwo8gBt7JDnOOstnps90K1wxmVfyhsTPPNTGBPjjg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e",
"rev": "da45bf6ec7bbcc5d1e14d3795c025199f28e0de0",
"type": "github"
},
"original": {
@ -811,11 +811,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1673800717,
"narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
"lastModified": 1678872516,
"narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
"rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8",
"type": "github"
},
"original": {
@ -843,11 +843,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1683014792,
"narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=",
"lastModified": 1685655444,
"narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42",
"rev": "e635192892f5abbc2289eaac3a73cdb249abaefd",
"type": "github"
},
"original": {
@ -875,11 +875,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1678293141,
"narHash": "sha256-lLlQHaR0y+q6nd6kfpydPTGHhl1rS9nU9OQmztzKOYs=",
"lastModified": 1680213900,
"narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c90c4025bb6e0c4eaf438128a3b2640314b1c58d",
"rev": "e3652e0735fbec227f342712f180f4f21f0594f2",
"type": "github"
},
"original": {
@ -891,11 +891,11 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1684724044,
"narHash": "sha256-OysG4ORx60BcUyBVClbOBVybqZ4Ep8Xh8EIDvNam4WU=",
"lastModified": 1685677062,
"narHash": "sha256-zoHF7+HNwNwne2XEomphbdc4Y8tdWT16EUxUTXpOKpQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b31c968ff28927d477eed85012e8090578c70852",
"rev": "95be94370d09f97f6af6a1df1eb9649b5260724e",
"type": "github"
},
"original": {
@ -907,11 +907,11 @@
},
"nixpkgs_6": {
"locked": {
"lastModified": 1684759798,
"narHash": "sha256-Kpbf5yKvKcj/yPqE1zYC6gju4JwTsYxTIZEvOII0jr4=",
"lastModified": 1685677062,
"narHash": "sha256-zoHF7+HNwNwne2XEomphbdc4Y8tdWT16EUxUTXpOKpQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c7eb65213bd7d95eafb8c5e2e181f04da103d054",
"rev": "95be94370d09f97f6af6a1df1eb9649b5260724e",
"type": "github"
},
"original": {
@ -962,11 +962,11 @@
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1684842236,
"narHash": "sha256-rYWsIXHvNhVQ15RQlBUv67W3YnM+Pd+DuXGMvCBq2IE=",
"lastModified": 1685361114,
"narHash": "sha256-4RjrlSb+OO+e1nzTExKW58o3WRwVGpXwj97iCta8aj4=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "61e567d6497bc9556f391faebe5e410e6623217f",
"rev": "ca2fdbf3edda2a38140184da6381d49f8206eaf4",
"type": "github"
},
"original": {
@ -989,11 +989,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1678376203,
"narHash": "sha256-3tyYGyC8h7fBwncLZy5nCUjTJPrHbmNwp47LlNLOHSM=",
"lastModified": 1680170909,
"narHash": "sha256-FtKU/edv1jFRr/KwUxWTYWXEyj9g8GBrHntC2o8oFI8=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "1a20b9708962096ec2481eeb2ddca29ed747770a",
"rev": "29dbe1efaa91c3a415d8b45d62d48325a4748816",
"type": "github"
},
"original": {
@ -1084,11 +1084,11 @@
]
},
"locked": {
"lastModified": 1682907601,
"narHash": "sha256-FfUAYvRJ+6s9WWjXNPdRzuuvAeu2VHIXIbUkPJr4t14=",
"lastModified": 1685413459,
"narHash": "sha256-+ELexqS2yN0wj1WnmWdF24OfjRBIgTN6Ltcpjvp2dEo=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "5eaff055dd57128c53ae373dc96af944f5849daa",
"rev": "9b3284e2412f76bd68ff46f8cf1c7af44d7ffac0",
"type": "github"
},
"original": {
@ -1115,16 +1115,16 @@
},
"stable": {
"locked": {
"lastModified": 1684661732,
"narHash": "sha256-2/Xo/UmUUoMXc0T5tzoUsYjMLLMjEfzRWDAQB0WwtW0=",
"lastModified": 1685620773,
"narHash": "sha256-iQ+LmporQNdLz8uMJdP62TaAWeLUwl43/MYUBtWqulM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b0671cbf1e5c443f7fbfd4941ee0f8a151435114",
"rev": "f0ba8235153dd2e25cf06cbf70d43efdd4443592",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.11",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
@ -1148,11 +1148,11 @@
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1682436395,
"narHash": "sha256-GGEjkQO9m7YLYIXIXM76HWdhjg4Ye+oafOtyaFAYKI4=",
"lastModified": 1685723274,
"narHash": "sha256-mjETVZbVheaSO0VRKQHWYAHcoKwYu0WZ0vhKVN7vyRo=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "6830bfc17fd94709e2cdd4da0af989f102a26e59",
"rev": "6668c822b3bf58ca5af5d370ef03b075be3e4d27",
"type": "gitlab"
},
"original": {
@ -1174,11 +1174,11 @@
]
},
"locked": {
"lastModified": 1682439384,
"narHash": "sha256-zHDa8LCZs05TZHQSIZ3ucwyMPglBGHcqTBzfkLjYXTM=",
"lastModified": 1685385764,
"narHash": "sha256-r+XMyOoRXq+hlfjayb+fyi9kq2JK48TrwuNIAXqlj7U=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "c0e233955568fbea4e859336f6d3d14d51294d7c",
"rev": "4d9ff0c17716936e0b5ca577a39e263633901ed1",
"type": "github"
},
"original": {

View File

@ -10,7 +10,7 @@
# Nix
master.url = "github:nixos/nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
stable.url = "github:nixos/nixpkgs/nixos-22.11";
stable.url = "github:nixos/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";

View File

@ -58,9 +58,9 @@ in
keepassxc
nixpkgs-review
pavucontrol
stable.libreoffice # HACK to fix build error
stable.signal-desktop
texlive.combined.scheme-full
stable.libreoffice # NOTE breaks often
stable.signal-desktop # NOTE breaks often
stable.texlive.combined.scheme-full # NOTE breaks often
thunderbird
vlc
];

View File

@ -7,22 +7,207 @@
with lib;
let
cfg = config.my.programs.nvim;
mkPlugin = fileName:
boolToString = bool: if bool then "true" else "false";
quote = str: ''"${toString str}"'';
listToString = list: ''{ ${concatStringsSep ", " (map quote list)} }'';
keybinding =
{ key
, cmd
, func
, mode
, desc
}:
let
path = ./plugins + "/${fileName}";
pluginName = lib.removeSuffix ".lua" fileName;
cmdString =
if cmd != null
then quote cmd
else
(
if func != null
then func
else abort "Either cmd or function must be set"
);
in
''{ ${quote key}, ${cmdString}, mode = ${quote mode}, ${optionalString (desc != null) "desc = ${quote desc},"} }'';
lazySpecFromPlugin =
{ plugin
, dependencies
, init
, conf
, lazy
, event
, enabled
, cmd
, ft
, priority
, keys
}:
''
{
dir = "${plugin}",
name = "${plugin.name}",
lazy = ${boolToString lazy},
enabled = ${boolToString enabled},
dependencies = { ${concatStringsSep ", " (map lazySpecFromPlugin dependencies)} },
${optionalString (init != null)
"init = function(plugin)
${toString init}
end,"
}
${optionalString (conf != null)
"config = function(plugin, opts)
${toString conf}
end,"
}
keys = { ${concatStringsSep ",\n" (map keybinding keys)} },
event = ${listToString event},
cmd = ${listToString cmd},
ft = ${listToString ft},
priority = ${toString priority},
}
'';
lazySpecs = concatStringsSep ", " (map lazySpecFromPlugin cfg.plugins);
lazy = ''
require("lazy").setup({
${lazySpecs}
})
'';
in
{
plugin = pkgs.vimPlugins.${pluginName};
type = "lua";
config = lib.readFile path;
imports = [ ./plugins ];
options.my.programs.nvim = {
enable = mkEnableOption "nvim";
plugins = mkOption {
default = [ ];
description = ''
List of plugins with config.
'';
type = with types; listOf (
let
sub = submodule {
options = {
conf = mkOption {
type = nullOr str;
default = null;
description = ''
Lua code to be executed when the plugin is loaded.
'';
};
dependencies = mkOption {
type = listOf sub;
default = [ ];
description = ''
List of plugins this plugin depends on.
'';
};
init = mkOption {
type = nullOr str;
default = null;
description = ''
Lua code to be executed when the plugin is initialized.
'';
};
event = mkOption {
type = listOf str;
default = [ ];
description = ''
Event to load the plugin on.
'';
};
lazy = mkOption {
type = bool;
default = false;
description = ''
Whether to load the plugin lazily.
'';
};
plugin = mkOption {
type = package;
description = ''
The plugin package.
'';
};
enabled = mkOption {
type = bool;
default = true;
description = ''
Whether to enable the plugin.
'';
};
cmd = mkOption {
type = listOf str;
default = [ ];
description = ''
Command to load the plugin.
'';
};
ft = mkOption {
type = listOf str;
default = [ ];
description = ''
Filetype to load the plugin on.
'';
};
priority = mkOption {
type = int;
default = 50;
description = ''
Priority to load the plugin.
'';
};
keys = mkOption {
default = [ ];
description = ''
List of keybindings.
'';
type = listOf (submodule {
options = {
key = mkOption {
type = str;
description = ''
Key to bind.
'';
};
cmd = mkOption {
type = nullOr str;
default = null;
description = ''
Command to execute.
'';
};
func = mkOption {
type = nullOr str;
default = null;
description = ''
Function to execute.
'';
};
mode = mkOption {
type = str;
default = "n";
description = ''
Mode to bind the key in.
'';
};
desc = mkOption {
type = nullOr str;
default = null;
description = ''
Description of the keybinding.
'';
};
};
});
};
};
};
pluginFileNames = builtins.attrNames (builtins.readDir ./plugins);
pluginsWithConfig = builtins.map mkPlugin pluginFileNames;
in
{
options.my.programs.nvim.enable = mkEnableOption "nvim";
sub
);
};
};
config = mkIf cfg.enable {
home-manager.users.moritz = {
@ -41,11 +226,7 @@ in
vimdiffAlias = true;
withNodeJs = true;
withPython3 = true;
extraLuaConfig = lib.concatLines (
builtins.map
builtins.readFile
[ ./options.lua ./keybinds.lua ./init.lua ]
);
extraLuaConfig = lib.concatLines [ (builtins.readFile ./options.lua) lazy ];
extraPackages = with pkgs; [
alejandra
black
@ -66,30 +247,10 @@ in
yamlfmt
];
plugins = with pkgs.vimPlugins; [
cmp-async-path
cmp-nvim-lsp
cmp_luasnip
copilot-cmp
direnv-vim
friendly-snippets
lsp_lines-nvim
lspkind-nvim
lspsaga-nvim-original
luasnip
nui-nvim
nvim-cmp
nvim-lspconfig
lazy-nvim
nvim-treesitter.withAllGrammars
nvim-ufo
nvim-web-devicons
plenary-nvim
popup-nvim
promise-async
vim-fugitive
vim-tmux-navigator
] ++ pluginsWithConfig;
];
};
};
};
}

View File

@ -1,73 +0,0 @@
-- buffer
require("which-key").register({
b = {
name = "buffer",
b = { "<cmd>Telescope buffers<cr>", "List buffers" },
d = { "<cmd>bd<cr>", "Delete buffer" },
},
}, { prefix = "<leader>" })
require("which-key").register({
["["] = {
b = { "<cmd>bprevious<cr>", "Previous buffer" },
},
["]"] = {
b = { "<cmd>bnext<cr>", "Next buffer" },
},
})
-- window
require("which-key").register({
w = {
name = "window",
["|"] = { "<C-w>v", "Split window horizontally" },
["-"] = { "<C-w>s", "Split window vertically" },
w = { "<C-w>w", "Switch window" },
d = { "<C-w>c", "Delete window" },
},
}, { prefix = "<leader>" })
-- tab
require("which-key").register({
["<tab>"] = {
name = "tab",
["<tab>"] = { "<cmd>tabnew<cr>", "New tab" },
n = { "<cmd>tabnext<cr>", "Next tab" },
p = { "<cmd>tabprevious<cr>", "Previous tab" },
d = { "<cmd>tabclose<cr>", "Close tab" },
},
}, { prefix = "<leader>" })
-- file
require("which-key").register({
f = {
name = "file/find",
n = { "<cmd>enew<cr>", "New file" },
},
}, { prefix = "<leader>" })
-- better descriptions for navigation
require("which-key").register({
["<leader>"] = {
f = { name = "file/find" },
g = { name = "git" },
l = { name = "lsp" },
o = { name = "org" },
s = { name = "search" },
t = { name = "toggle" },
x = { name = "diagnostics/quickfix" },
},
["["] = { name = "prev" },
["]"] = { name = "next" },
g = { name = "goto" },
})
-- Clear search with <esc>
require("which-key").register({
["<esc>"] = { "<cmd>noh<cr><esc>", "Escape and clear hlsearch", mode = { "n", "i" } },
})
-- better indenting
require("which-key").register({
["<"] = { "<gv", "Shift left" },
[">"] = { ">gv", "Shift right" },
}, { mode = "v" })

View File

@ -2,10 +2,4 @@ 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("which-key").register({
c = { "<cmd>Copilot toggle<cr>", "Toggle Copilot" },
}, { prefix = "<leader>t" })
vim.cmd("Copilot disable")

View File

@ -0,0 +1,254 @@
{ pkgs, ... }:
with builtins;
{
config.my.programs.nvim.plugins = with pkgs.vimPlugins; [
{
plugin = which-key-nvim;
conf = readFile ./which-key-nvim.lua;
}
{
plugin = catppuccin-nvim;
conf = readFile ./catppuccin-nvim.lua;
priority = 99;
}
{
plugin = formatter-nvim;
lazy = true;
keys = [
{ key = "="; cmd = "<cmd>Format<cr>"; desc = "format (formatter)"; }
];
conf = readFile ./formatter-nvim.lua;
dependencies = [{ plugin = which-key-nvim; lazy = true; }];
}
{
plugin = oil-nvim;
conf = readFile ./oil-nvim.lua;
dependencies = [
{ plugin = which-key-nvim; lazy = true; }
{ plugin = nvim-web-devicons; lazy = true; }
];
}
{
plugin = mini-nvim;
conf = readFile ./mini-nvim.lua;
}
{
plugin = noice-nvim;
conf = readFile ./noice-nvim.lua;
dependencies = [{ plugin = nui-nvim; lazy = true; }];
}
{
plugin = trouble-nvim;
lazy = true;
keys = [
{ key = "<leader>xx"; cmd = "<cmd>TroubleToggle document_diagnostics<cr>"; desc = "Document Diagnostics (Trouble)"; }
{ key = "<leader>xX"; cmd = "<cmd>TroubleToggle workspace_diagnostics<cr>"; desc = "Workspace Diagnostics (Troule)"; }
{ key = "<leader>xl"; cmd = "<cmd>TroubleToggle loclist<cr>"; desc = "Location List (Trouble)"; }
{ key = "<leader>xq"; cmd = "<cmd>TroubleToggle quickfix<cr>"; desc = "Quickfix List (Trouble)"; }
{ key = "<leader>xt"; cmd = "<cmd>TodoTrouble<cr>"; desc = "Todo (Trouble)"; }
{ key = "<leader>xT"; cmd = "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>"; desc = "Todo/Fix/Fixme (Trouble)"; }
{ key = "<leader>st"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; }
{
key = "[q";
func = ''function()
if require("trouble").is_open() then
require("trouble").previous({ skip_groups = true, jump = true })
else
vim.cmd.cprev()
end
end'';
desc = "Previous trouble/quickfix item";
}
{
key = "]q";
func = ''function()
if require("trouble").is_open() then
require("trouble").next({ skip_groups = true, jump = true })
else
vim.cmd.cnext()
end
end'';
desc = "Next trouble/quickfix item";
}
];
conf = readFile ./trouble-nvim.lua;
dependencies = [
{ plugin = which-key-nvim; }
{ plugin = nvim-web-devicons; lazy = true; }
];
}
{
plugin = nvim-cmp;
conf = readFile ./nvim-cmp.lua;
lazy = true;
event = [ "InsertEnter" ];
dependencies = [
{ plugin = cmp-async-path; }
{ plugin = cmp-nvim-lsp; }
{ plugin = cmp_luasnip; }
{
plugin = copilot-cmp;
dependencies = [
{
plugin = copilot-lua;
conf = readFile ./copilot-lua.lua;
dependencies = [{ plugin = which-key-nvim; }];
}
];
}
{ plugin = friendly-snippets; }
{ plugin = luasnip; lazy = true; }
];
}
{
plugin = todo-comments-nvim;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./todo-comments-nvim.lua;
dependencies = [{ plugin = plenary-nvim; lazy = true; }];
}
{
plugin = direnv-vim;
}
{
plugin = nvim-treesitter.withAllGrammars;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-treesitter.lua;
dependencies = [
{
plugin = orgmode;
lazy = true;
conf = readFile ./orgmode.lua;
}
];
}
{
plugin = nvim-lspconfig;
lazy = true;
event = [ "BufReadPre" "BufNewFile" ];
conf = readFile ./nvim-lspconfig.lua;
dependencies = [
{
plugin = null-ls-nvim;
lazy = true;
conf = readFile ./null-ls-nvim.lua;
dependencies = [
{ plugin = which-key-nvim; lazy = true; }
{ plugin = plenary-nvim; lazy = true; }
];
}
{
plugin = which-key-nvim;
lazy = true;
}
{
plugin = lspkind-nvim;
lazy = true;
}
{
plugin = lsp_lines-nvim;
lazy = true;
}
{
plugin = lspsaga-nvim-original;
lazy = true;
dependencies = [
{ plugin = nvim-web-devicons; lazy = true; }
{ plugin = nvim-treesitter.withAllGrammars; lazy = true; }
];
}
{
plugin = nvim-ufo;
lazy = true;
dependencies = [
{ plugin = promise-async; lazy = true; }
];
}
];
}
{
event = [ "VeryLazy" ];
lazy = true;
plugin = vim-fugitive;
}
{
plugin = vim-tmux-navigator;
}
{
plugin = gitsigns-nvim;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./gitsigns-nvim.lua;
dependencies = [{ plugin = which-key-nvim; }];
}
{
plugin = nvim-lastplace;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-lastplace.lua;
}
{
plugin = nvim-treesitter-textsubjects;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-treesitter-textsubjects.lua;
dependencies = [
{
plugin = nvim-treesitter.withAllGrammars;
lazy = true;
}
];
}
{
plugin = nvim-ts-context-commentstring;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-ts-context-commentstring.lua;
dependencies = [
{
plugin = nvim-treesitter.withAllGrammars;
lazy = true;
}
];
}
{
plugin = smartcolumn-nvim;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./smartcolumn-nvim.lua;
}
{
plugin = telescope-fzf-native-nvim;
conf = readFile ./telescope-fzf-native-nvim.lua;
lazy = true;
keys = [
{ key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; }
{ key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; }
{ key = "<leader>fr"; cmd = "<cmd>Telescope oldfiles<cr>"; desc = "Find recent files"; }
{ key = "<leader>sl"; cmd = "<cmd>Telescope current_buffer_fuzzy_find<cr>"; desc = "Search lines"; }
{ key = "<leader>sg"; cmd = "<cmd>Telescope live_grep<cr>"; desc = "Live grep"; }
{ key = "<leader>sc"; cmd = "<cmd>Telescope command_history<cr>"; desc = "Command history"; }
{ key = "<leader>sC"; cmd = "<cmd>Telescope commands<cr>"; desc = "Commands"; }
{ key = "<leader>sd"; cmd = "<cmd>Telescope diagnostics<cr>"; desc = "Diagnostics"; }
{ key = "<leader>sh"; cmd = "<cmd>Telescope help_tags<cr>"; desc = "Help tags"; }
{ key = "<leader>sk"; cmd = "<cmd>Telescope keymaps<cr>"; desc = "Keymaps"; }
{ key = "<leader>ss"; cmd = "<cmd>Telescope lsp_document_symbols<cr>"; desc = "Symbols (Document)"; }
{ key = "<leader>sS"; cmd = "<cmd>Telescope lsp_workspace_symbols<cr>"; desc = "Symbols (Workspace)"; }
{ key = "<leader>gc"; cmd = "<cmd>Telescope git_commits<cr>"; desc = "Commits"; }
{ key = "<leader>gs"; cmd = "<cmd>Telescope git_status<cr>"; desc = "Status"; }
];
dependencies = [
{
plugin = telescope-nvim;
lazy = true;
dependencies = [
{ plugin = plenary-nvim; lazy = true; }
{ plugin = which-key-nvim; lazy = true; }
];
}
];
}
];
}

View File

@ -65,7 +65,3 @@ end, {
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,63 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
require("copilot_cmp").setup()
local default_sources = {
{ name = "async_path", priority = 1 },
{ name = "copilot", priority = 2 },
{ name = "luasnip", priority = 2 },
{ name = "nvim_lsp", priority = 3 },
}
cmp.setup({
formatting = {
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
symbol_map = {
Copilot = "",
},
}),
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_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.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = default_sources,
})
cmp.setup.filetype("org", {
sources = vim.tbl_deep_extend("force", default_sources, {
{ name = "buffer", priority = 1 },
{ name = "orgmode", priority = 3 },
}),
})

View File

@ -1,87 +1,3 @@
vim.loader.enable()
-- Load custom treesitter grammar for org filetype
require("orgmode").setup_ts_grammar()
require("nvim-treesitter.configs").setup({
sync_install = false,
auto_install = false,
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { "org" },
},
})
-- load cmp on InsertEnter
vim.api.nvim_create_autocmd("InsertEnter", {
callback = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
require("copilot_cmp").setup()
local default_sources = {
{ name = "async_path", priority = 1 },
{ name = "copilot", priority = 2 },
{ name = "luasnip", priority = 2 },
{ name = "nvim_lsp", priority = 3 },
}
cmp.setup({
formatting = {
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
symbol_map = {
Copilot = "",
},
}),
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_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.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = default_sources,
})
cmp.setup.filetype("org", {
sources = vim.tbl_deep_extend("force", default_sources, {
{ name = "buffer", priority = 1 },
{ name = "orgmode", priority = 3 },
}),
})
end,
})
local lsp_lines = require("lsp_lines")
lsp_lines.setup()
-- Disable virtual_text since it's redundant due to lsp_lines.

View File

@ -0,0 +1,12 @@
-- Load custom treesitter grammar for org filetype
require("orgmode").setup_ts_grammar()
require("nvim-treesitter.configs").setup({
sync_install = false,
auto_install = false,
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { "org" },
},
})

View File

@ -1,22 +0,0 @@
require("which-key").register({
f = {
f = { "<cmd>Telescope find_files<cr>", "Find files" },
b = { "<cmd>Telescope buffers<cr>", "Find buffers" },
r = { "<cmd>Telescope oldfiles<cr>", "Find recent files" },
},
s = {
l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "Search lines" },
g = { "<cmd>Telescope live_grep<cr>", "Live grep" },
c = { "<cmd>Telescope command_history<cr>", "Command history" },
C = { "<cmd>Telescope commands<cr>", "Commands" },
d = { "<cmd>Telescope diagnostics<cr>", "Diagnostics" },
h = { "<cmd>Telescope help_tags<cr>", "Help tags" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Symbols (Document)" },
S = { "<cmd>Telescope lsp_workspace_symbols<cr>", "Symbols (Workspace)" },
},
g = {
c = { "<cmd>Telescope git_commits<cr>", "Commits" },
s = { "<cmd>Telescope git_status<cr>", "Status" },
},
}, { prefix = "<leader>" })

View File

@ -1,38 +1 @@
require("trouble").setup()
require("which-key").register({
x = { "<cmd>TroubleToggle document_diagnostics<cr>", "Document Diagnostics (Trouble)" },
X = { "<cmd>TroubleToggle workspace_diagnostics<cr>", "Workspace Diagnostics (Troule)" },
l = { "<cmd>TroubleToggle loclist<cr>", "Location List (Trouble)" },
q = { "<cmd>TroubleToggle quickfix<cr>", "Quickfix List (Trouble)" },
t = { "<cmd>TodoTrouble<cr>", "Todo (Trouble)" },
T = { "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", "Todo/Fix/Fixme (Trouble)" },
}, { prefix = "<leader>x" })
require("which-key").register({
t = { "<cmd>TodoTelescope<cr>", "Todo" },
}, { prefix = "<leader>s" })
require("which-key").register({
["["] = {
q = {
function()
if require("trouble").is_open() then
require("trouble").previous({ skip_groups = true, jump = true })
else
vim.cmd.cprev()
end
end,
"Previous trouble/quickfix item",
},
},
["]"] = {
q = {
function()
if require("trouble").is_open() then
require("trouble").next({ skip_groups = true, jump = true })
else
vim.cmd.cnext()
end
end,
"Next trouble/quickfix item",
},
},
})

View File

@ -1,2 +1,76 @@
vim.o.timeout = true
vim.o.timeoutlen = 500
-- buffer
require("which-key").register({
b = {
name = "buffer",
b = { "<cmd>Telescope buffers<cr>", "List buffers" },
d = { "<cmd>bd<cr>", "Delete buffer" },
},
}, { prefix = "<leader>" })
require("which-key").register({
["["] = {
b = { "<cmd>bprevious<cr>", "Previous buffer" },
},
["]"] = {
b = { "<cmd>bnext<cr>", "Next buffer" },
},
})
-- window
require("which-key").register({
w = {
name = "window",
["|"] = { "<C-w>v", "Split window horizontally" },
["-"] = { "<C-w>s", "Split window vertically" },
w = { "<C-w>w", "Switch window" },
d = { "<C-w>c", "Delete window" },
},
}, { prefix = "<leader>" })
-- tab
require("which-key").register({
["<tab>"] = {
name = "tab",
["<tab>"] = { "<cmd>tabnew<cr>", "New tab" },
n = { "<cmd>tabnext<cr>", "Next tab" },
p = { "<cmd>tabprevious<cr>", "Previous tab" },
d = { "<cmd>tabclose<cr>", "Close tab" },
},
}, { prefix = "<leader>" })
-- file
require("which-key").register({
f = {
name = "file/find",
n = { "<cmd>enew<cr>", "New file" },
},
}, { prefix = "<leader>" })
-- better descriptions for navigation
require("which-key").register({
["<leader>"] = {
f = { name = "file/find" },
g = { name = "git" },
l = { name = "lsp" },
o = { name = "org" },
s = { name = "search" },
t = { name = "toggle" },
x = { name = "diagnostics/quickfix" },
},
["["] = { name = "prev" },
["]"] = { name = "next" },
g = { name = "goto" },
})
-- Clear search with <esc>
require("which-key").register({
["<esc>"] = { "<cmd>noh<cr><esc>", "Escape and clear hlsearch", mode = { "n", "i" } },
})
-- better indenting
require("which-key").register({
["<"] = { "<gv", "Shift left" },
[">"] = { ">gv", "Shift right" },
}, { mode = "v" })

View File

@ -69,8 +69,8 @@
services.openssh = {
settings = {
# Disable ssh password login
passwordAuthentication = lib.mkDefault false;
logLevel = "VERBOSE";
PasswordAuthentication = lib.mkDefault false;
LogLevel = "VERBOSE";
};
extraConfig = ''
AllowAgentForwarding no