-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
146 lines (133 loc) · 3.64 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
description = "Provide nixosModules for ergotu/neovim";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
flake-utils = {
url = "github:numtide/flake-utils";
};
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
devenv = {
url = "github:cachix/devenv";
inputs.nixpkgs.follows = "nixpkgs";
};
nix2container = {
url = "github:nlewo/nix2container";
inputs = {nixpkgs.follows = "nixpkgs";};
};
};
outputs = inputs @ {
self,
flake-parts,
...
}:
flake-parts.lib.mkFlake {inherit inputs;}
{
imports = [
inputs.devenv.flakeModule
];
flake = {
homeManagerModules = {
nvimdots = ./nixos;
};
};
systems = ["aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin"];
perSystem = {
system,
pkgs,
...
}: let
extraPackages = [
pkgs.ast-grep
pkgs.doq
pkgs.tree-sitter
pkgs.cargo
pkgs.zig
pkgs.cmake
pkgs.curl
pkgs.fd
pkgs.gcc
pkgs.git
pkgs.gnumake
pkgs.go
pkgs.lua51Packages.luarocks
pkgs.ninja
pkgs.ripgrep
pkgs.pkg-config
pkgs.yarn
pkgs.dwt1-shell-color-scripts
];
packagesPath = pkgs.lib.makeBinPath extraPackages;
initFile = pkgs.writeTextFile {
name = "init.lua";
text =
#lua
''
vim.loader.enable()
-- lazy.nvim resets rtp for performance reasons, so we need to pass the path of the configuration
vim.g.rtp_path = "${./.}"
-- add source to rtp_path so we can load our configuration
vim.opt.rtp:append(vim.g.rtp_path)
-- load configuration
require("ergotu")
'';
};
neovimConfig =
pkgs.neovimUtils.makeNeovimConfig {
customRC = "luafile ${initFile}";
}
// {
viAlias = true;
vimAlias = true;
withNodeJs = false;
withPython3 = false;
withRuby = false;
wrapperArgs = pkgs.lib.escapeShellArgs ["--suffix" "PATH" ":" "${packagesPath}"];
extraPackages = [pkgs.imagemagick];
extraLuaPackages = ps: [ps.magick];
};
in {
packages = {
default = self.packages.${system}.neovim;
neovim = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped neovimConfig;
};
devenv.shells.default = {
pre-commit = {
src = ./.;
hooks = {
statix.enable = true;
alejandra.enable = true;
stylua.enable = true;
commitizen.enable = true;
};
};
enterShell = ''
export PATH=${packagesPath}:$PATH
'';
env.NIX_PATH = "nixpkgs=${inputs.nixpkgs}";
languages = {
nix = {
enable = true;
lsp.package = pkgs.nixd;
};
lua.enable = true;
};
packages =
extraPackages
++ [
# Nix LSP and formatter
pkgs.nixd
pkgs.alejandra
];
};
};
};
}