-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
260 lines (226 loc) · 6.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
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
{
description = "My NixOS flakes configuration makes me feel like the world is my oyster";
outputs = inputs @ {
self,
home-manager,
flake-utils-plus,
haumea,
pre-commit-hooks,
programs-sqlite,
nixos-generators,
...
}: let
inherit (inputs.nixpkgs) lib;
inherit (flake-utils-plus.lib) mkFlake;
mylib = import ./lib {inherit lib;};
myvars = import ./vars;
specialArgs =
inputs
// {
inherit mylib myvars;
};
hl = haumea.lib;
hosts = hl.load {
src = ./hosts;
# Make the default.nix's attrs directly children of lib
transformer = hl.transformers.liftDefault;
};
in
mkFlake {
inherit self inputs;
############
# channels #
############
supportedSystems = import inputs.systems;
channelsConfig = {
allowUnfree = true;
allowBroken = true;
};
# channels.nixpkgs.overlaysBuilder = channels: [
# (final: prev: { inherit (channels.nixpkgs-stable) bat-extras; })
# ];
# TODO: rewrite overlays instructures
sharedOverlays = import ./overlays inputs;
#########
# Hosts #
#########
inherit hosts;
hostDefaults = {
inherit specialArgs;
modules = [
./modules/nix.nix
./modules/nixos
./secrets
nixos-generators.nixosModules.all-formats
programs-sqlite.nixosModules.programs-sqlite
home-manager.nixosModules.home-manager
{
home-manager = {
backupFileExtension = "hm-bak";
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = specialArgs;
users."${myvars.userName}".imports = [
./home
];
};
}
];
};
###########
# Outputs #
###########
outputsBuilder = channels: let
pkgs = channels.nixpkgs;
in {
checks = {
pre-commit-check = pre-commit-hooks.lib."${pkgs.system}".run {
src = ./.;
hooks = {
alejandra.enable = true; # formatter
typos = {
enable = true;
settings = {
write = true; # Automatically fix typos
configPath = "./.typos.toml"; # relative to the flake root
};
};
prettier = {
enable = true;
settings = {
write = true; # Automatically format files
configPath = "./.prettierrc.yaml"; # relative to the flake root
};
};
deadnix.enable = true; # detect unused variable bindings in "*.nix"
statix.enable = true; # lints and suggestions for Nix code
};
};
};
# Development Shells
devShells.default = pkgs.mkShell {
packages = with pkgs; [
bashInteractive
gcc
alejandra
deadnix
statix
typos
nodePackages.prettier
];
name = "dots";
shellHook = ''
${self.checks.${pkgs.system}.pre-commit-check.shellHook}
'';
};
formatter = pkgs.alejandra;
};
};
inputs = {
# Official NixOS package source, using nixos's unstable branch by default
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-small.url = "github:nixos/nixpkgs/nixos-unstable-small";
home-manager = {
# url = "github:nix-community/home-manager/release-24.05";
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
yazi = {
url = "github:sxyazi/yazi";
inputs.nixpkgs.follows = "nixpkgs";
};
ags = {
url = "github:Aylur/ags";
inputs.nixpkgs.follows = "nixpkgs";
};
systems.url = "github:nix-systems/default-linux";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
flake-utils-plus = {
url = "github:gytis-ivaskevicius/flake-utils-plus/v1.4.0";
inputs.flake-utils.follows = "flake-utils";
};
haumea = {
url = "github:nix-community/haumea/v0.2.2";
inputs.nixpkgs.follows = "nixpkgs";
};
# disko for declarative partitioning
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# secrets management
agenix = {
# type-safe reimplementation of agenix to get a better error messages and less bugs
url = "github:yaxitech/ragenix";
inputs.nixpkgs.follows = "nixpkgs";
};
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.4.1";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
# generate iso/qcow2/docker/... image from nixos configuration
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
# Third party programs, packaged with nix
firefox-addons = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
programs-sqlite = {
url = "github:wamserma/flake-programs-sqlite";
# inputs.nixpkgs.follows = "nixpkgs";
};
matugen = {
url = "github:/InioX/Matugen";
inputs.nixpkgs.follows = "nixpkgs";
};
wallpapers = {
url = "github:huwqchn/wallpapers";
flake = false;
};
# stylix = {
# url = "github:danth/stylix";
# inputs.nixpkgs.follows = "nixpkgs";
# };
# hyprwm
# hyprland = {
# type = "git";
# url = "https://github.com/hyprwm/Hyprland";
# submodules = true;
# };
# hyprland-plugins = {
# url = "github:hyprwm/hyprland-plugins";
# inputs.hyprland.follows = "hyprland";
# };
dedsec-grub-theme = {
url = "gitlab:VandalByte/dedsec-grub-theme";
inputs.nixpkgs.follows = "nixpkgs";
};
# neovim nightly overlay
neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
# wezterm git
wezterm-git = {
url = "github:wez/wezterm?dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
zen-browser = {
url = "github:fufexan/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}