-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
277 lines (241 loc) · 7.39 KB
/
flake.nix
File metadata and controls
277 lines (241 loc) · 7.39 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
{
description = "chrishrb's nix-dots";
inputs = {
# system packages
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.11";
home-manager = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/home-manager/master";
};
# macOS system config
darwin = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:LnL7/nix-darwin/master";
};
# homebrew
nix-homebrew = {
url = "github:zhaofengli/nix-homebrew";
};
homebrew-bundle = {
url = "github:homebrew/homebrew-bundle";
flake = false;
};
homebrew-core = {
url = "github:homebrew/homebrew-core";
flake = false;
};
homebrew-cask = {
url = "github:homebrew/homebrew-cask";
flake = false;
};
# alacritty theme
alacritty-theme.url = "github:alexghr/alacritty-theme.nix";
# mac-app-util for fixing trampoline apps on mac
mac-app-util.url = "github:hraban/mac-app-util";
# talhelper
talhelper.url = "github:budimanjojo/talhelper";
# nvim
nixCats.url = "github:BirdeeHub/nixCats-nvim/v7.2.13";
# pre-commit
git-hooks.url = "github:cachix/git-hooks.nix";
# ai tools
mcp-hub.url = "github:ravitemer/mcp-hub";
# TODO: replace when ravitemer/mcphub.nvim#279 is merged
mcphub-nvim.url = "github:bahaaza/mcphub.nvim";
ruby-build = {
url = "github:rbenv/ruby-build";
flake = false;
};
# nvim plugins that are not in nixpkg
nvim-tmux-navigation = {
url = "github:alexghergh/nvim-tmux-navigation";
flake = false;
};
nvim-nio = {
url = "github:nvim-neotest/nvim-nio";
flake = false;
};
codecompanion-nvim = {
url = "github:olimorris/codecompanion.nvim";
flake = false;
};
codecompanion-history-nvim = {
url = "github:ravitemer/codecompanion-history.nvim";
flake = false;
};
none-ls-extras-nvim = {
url = "github:nvimtools/none-ls-extras.nvim";
flake = false;
};
nvim-tree-lua = {
url = "github:nvim-tree/nvim-tree.lua";
flake = false;
};
garbage-day-nvim = {
url = "github:Zeioth/garbage-day.nvim";
flake = false;
};
# keyboard layout
macos-keyboard-layout-german-programming = {
url = "github:MickL/macos-keyboard-layout-german-programming";
flake = false;
};
# agenix for secrets management
agenix.url = "github:ryantm/agenix";
# Dependency for MCP
powertools-lambda-python = {
url = "github:aws-powertools/powertools-lambda-python";
flake = false;
};
# MCP servers
mcp-servers-nix.url = "github:natsukium/mcp-servers-nix";
awslabs-mcp = {
url = "github:awslabs/mcp";
flake = false;
};
go-grip = {
url = "github:chrishrb/go-grip";
};
# glide
glide = {
url = "github:glide-browser/glide.nix";
};
};
outputs =
{
self,
nixpkgs,
...
}@inputs:
let
# Global configuration for my systems
globals = rec {
user = "chrishrb";
fullName = "Christoph Herb";
gitName = fullName;
gitEmail = "52382992+chrishrb@users.noreply.github.com";
gitWorkEmail = gitEmail;
};
# Common overlays
overlays = [
inputs.alacritty-theme.overlays.default
inputs.mcp-servers-nix.overlays.default
(import ./overlays inputs)
];
# System types to support.
supportedSystems = [
"aarch64-darwin"
"x86_64-linux"
];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
rec {
# Contains my full system builds, including home-manager
# nixos-rebuild switch --flake .#tuxedo
nixosConfigurations = {
tuxedo = import ./hosts/tuxedo { inherit inputs globals overlays; };
};
# Contains my full Mac system builds, including home-manager
# darwin-rebuild switch --flake .#cc
darwinConfigurations = {
macbook-gipedo = import ./hosts/macbook-gipedo { inherit inputs globals overlays; };
macbook-christoph = import ./hosts/macbook-christoph { inherit inputs globals overlays; };
};
# For quickly applying home-manager settings with:
# home-manager switch --flake .#cc
homeConfigurations = {
tuxedo = nixosConfigurations.tuxedo.config.home-manager.users."christophherb".home;
macbook-gipedo = darwinConfigurations.macbook-gipedo.config.home-manager.users."christophherb".home;
macbook-christoph =
darwinConfigurations.macbook-christoph.config.home-manager.users."christophherb".home;
};
# Programs that can be run by calling this flake
apps = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
in
import ./apps { inherit system inputs pkgs; }
);
# Development environments
devShells = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
inherit (self.checks.${system}.pre-commit-check) shellHook enabledPackages;
in
{
# Used to run commands and edit files in this repo
default = pkgs.mkShell {
inherit shellHook;
buildInputs = with pkgs; [
git
stylua
nixfmt
shfmt
shellcheck
mkpasswd
inputs.agenix.packages.${system}.default
enabledPackages
];
};
}
);
# Checks for nvim health
checks = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
module = import ./modules/common/nvim { inherit inputs; };
in
{
nvim =
pkgs.runCommand "neovim-check-health" { buildInputs = [ module.packages.${system}.default ]; }
''
mkdir -p $out
export HOME=$TMPDIR
nvim --headless -c "checkhealth" -c "write $out/health.log" -c "quitall"
# Check for errors inside the health log
if $(grep "ERROR" $out/health.log); then
cat $out/health.log
exit 1
fi
'';
pre-commit-check = inputs.git-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixfmt.enable = true;
stylua.enable = true;
shellcheck.enable = true;
};
};
}
);
formatter = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
config = self.checks.${system}.pre-commit-check.config;
inherit (config) package configFile;
script = ''
${pkgs.lib.getExe package} run --all-files --config ${configFile}
'';
in
pkgs.writeShellScriptBin "pre-commit-run" script
);
# Templates for starting other projects quickly
templates = rec {
default = basic;
basic = {
path = ./templates/basic;
description = "Basic program template";
};
python = {
path = ./templates/python;
description = "Python template";
};
};
};
}