-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
210 lines (183 loc) · 5.76 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
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
{
description = "chrishrb's nix-dots";
inputs = {
# system packages
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.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;
};
homebrew-mqttx = {
url = "github:emqx/homebrew-mqttx";
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";
# chrisNvim
nixCats.url = "github:BirdeeHub/nixCats-nvim/v5.6.5";
# 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;
};
none-ls-extras-nvim = {
url = "github:nvimtools/none-ls-extras.nvim";
flake = false;
};
# keyboard layout
macos-keyboard-layout-german-programming = {
url = "github:MickL/macos-keyboard-layout-german-programming";
flake = false;
};
# cli tool for automatically creating commit messages
ai-commit = {
url = "github:chrishrb/ai-commit";
};
go-grip = {
url = "github:chrishrb/go-grip";
};
};
outputs =
{ nixpkgs, ... }@inputs:
let
# Global configuration for my systems
globals = rec {
user = "chrisrb";
fullName = "Christoph Herb";
gitName = fullName;
gitEmail = "[email protected]";
gitWorkEmail = "[email protected]";
dotfilesRepo = "[email protected]:chrishrb/nix-dots.git";
};
# Common overlays
overlays = [
inputs.alacritty-theme.overlays.default
(import ./overlays/stable.nix inputs)
(import ./overlays/talhelper.nix inputs)
(import ./overlays/personal.nix inputs)
(import ./overlays/catppuccin.nix 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 .#ambush
# nixosConfigurations = {
# ambush = import ./hosts/ambush { inherit inputs globals overlays; };
# };
# Contains my full Mac system builds, including home-manager
# darwin-rebuild switch --flake .#cc
darwinConfigurations = {
mb-pro-cc = import ./hosts/mb-pro-cc { 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 = {
# ambush = nixosConfigurations.ambush.config.home-manager.users."christoph".home;
mb-pro-cc = darwinConfigurations.mb-pro-cc.config.home-manager.users."christophherb".home;
macbook-christoph = darwinConfigurations.cc.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; };
in
{
# Used to run commands and edit files in this repo
default = pkgs.mkShell {
buildInputs = with pkgs; [
git
stylua
nixfmt-rfc-style
shfmt
shellcheck
];
};
}
);
# Checks for nvim health
checks = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
module = import ./modules/common/nvim { inherit inputs; };
in
{
chrisNvim =
pkgs.runCommand "neovim-check-health" { buildInputs = [ module.packages.${system}.default ]; }
''
mkdir -p $out
export HOME=$TMPDIR
chrisNvim -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
'';
}
);
# 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";
};
};
};
}