-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
116 lines (103 loc) · 3.67 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{
description = "feovim";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# define plugin sources from git or use package from nixpkgs instead
whaler = { url = "github:SalOrak/whaler"; flake = false; };
inlay-hints = { url = "github:MysticalDevil/inlay-hints.nvim"; flake = false; };
};
outputs = { self, nixpkgs, flake-utils, nixpkgs-unstable, ... }@inputs:
{
overlay = final: prev: {
neovim = self.packages.${prev.system}.default;
};
# home-manager module for IdeaVim + VSCode integration
feovim = { config, lib, ... }: with lib; {
options.feovim = {
ideavim.enable = mkEnableOption "IntelliJ IDEA integration";
vscode.enable = mkEnableOption "VSCode integration";
};
config = with config.feovim; {
home.file = {
ideavim = mkIf ideavim.enable {
target = ".ideavimrc";
# TODO auto import all .vim files
text = fileContents ./base.vim;
};
vscode = mkIf vscode.enable {
target = ".vscodevimrc";
# TODO auto import all .vim files
text = fileContents ./base.vim;
};
};
};
};
} //
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
unstable = import nixpkgs-unstable { inherit system; };
# installs a vim plugin from git
plugin = with pkgs; repo: vimUtils.buildVimPlugin {
pname = "${lib.strings.sanitizeDerivationName repo}";
version = "main";
src = builtins.getAttr repo inputs;
};
# TODO auto import all nix files except flake.nix itself
files = [
./lsp.nix
./syntax.nix
./completion.nix
./ui.nix
./tree.nix
./telescope.nix
./formatting.nix
];
plugins = map (name: import name { inherit pkgs plugin unstable; }) files;
binaries = map (x: x.binaries) plugins;
lazySpec = builtins.concatStringsSep "\n" (map (x: x.lazy) plugins);
in
with pkgs; rec {
apps.default = flake-utils.lib.mkApp {
drv = packages.default;
exePath = "/bin/nvim";
};
packages.default = wrapNeovimUnstable neovim-unwrapped {
viAlias = true;
vimAlias = true;
# use unique to filter out duplicates
wrapperArgs = with lib; ''--prefix PATH : "${makeBinPath (lists.unique (lists.flatten binaries))}"'';
# only lazy is needed, it handles the rest
plugins = with pkgs.vimPlugins; [ lazy-nvim ];
luaRcContent =
# lua
''
-- i want my basics to be in vimscript
-- they are used by vscode and intellij aswell
-- TODO auto import all .vim files
vim.cmd([[
${builtins.readFile ./base.vim}
]])
-- TODO: maybe also allow non lazy lua config?
${builtins.readFile ./base.lua}
require("lazy").setup({
-- disable all update / install features
-- this is handled by nix
rocks = { enabled = false },
pkg = { enabled = false },
install = { missing = false },
change_detection = { enabled = false },
spec = {
${lazySpec}
},
})
'';
};
}
);
}