-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
314 lines (279 loc) · 8.35 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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
{
description = "NeurNix Flake";
inputs = {
# Core inputs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/master";
# url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-wsl = {
url = "github:nix-community/NixOS-WSL/main";
};
systems = {
url = "systems";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
};
pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
#inputs.nur.url = github:nix-community/NUR;
# WM & GUI
hyprland = {
url = "github:hyprwm/Hyprland";
# inputs.nixpkgs.follows = "nixpkgs";
};
Hyprspace = {
url = "github:KZDKM/Hyprspace";
inputs.hyprland.follows = "hyprland";
};
/*
hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins";
inputs.hyprland.follows = "hyprland";
};
*/
zen-browser = {
url = "github:0xc000022070/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
firefox-addons = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
ags = {
url = "github:Aylur/ags/v1";
inputs.nixpkgs.follows = "nixpkgs";
};
# CPU undervolt Loki host
vermeer-undervolt = {
url = "github:Neurarian/5800x3d-undervolt/fixLoop";
inputs.nixpkgs.follows = "nixpkgs";
};
# Color scheme
catppuccin.url = "github:catppuccin/nix";
matugen = {
url = "github:Neurarian/matugen/add-vibrant-scheme";
inputs.nixpkgs.follows = "nixpkgs";
};
# Secret provisioning
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Terminal
wezterm = {
url = "github:wez/wezterm?dir=nix";
# Workaround to avoid buildfailure due to outdated rust-overlay in wezterm flake
inputs.nixpkgs.follows = "nixpkgs";
};
# Nvim
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
};
nixCats = {
url = "github:BirdeeHub/nixCats-nvim";
};
plugins-care-nvim = {
url = "github:max397574/care.nvim";
flake = true;
};
plugins-care-cmp = {
url = "github:max397574/care-cmp";
flake = false;
};
plugins-fzy-lua-native = {
url = "github:romgrk/fzy-lua-native";
flake = false;
};
plugins-friendly-snippets = {
url = "github:rafamadriz/friendly-snippets";
flake = false;
};
plugins-telescope-luasnip = {
url = "github:benfowler/telescope-luasnip.nvim";
flake = false;
};
plugins-arduino-nvim = {
url = "github:stevearc/vim-arduino";
flake = false;
};
plugins-rNvim = {
url = "github:R-nvim/R.nvim";
flake = false;
};
plugins-cmp-r = {
url = "github:R-nvim/cmp-r";
flake = false;
};
};
outputs = {
nixpkgs,
home-manager,
catppuccin,
flake-parts,
pre-commit-hooks,
self,
...
} @ inputs: let
inherit (nixpkgs) lib;
user = "Liqyid";
overlays = with inputs; [
plugins-care-nvim.overlays.default
neovim-nightly-overlay.overlays.default
(final: _prev: {
# I think this is a kinda ugly, hacky way of calling and overlaying the custom nixCats package.
# But I want to have it easily available in pure nix-shells and keep it integrated as a module.
nixCats = self.nixosConfigurations.Loki.config.home-manager.users.${user}.nixCats.out.packages.nvimFull;
nixCatsStripped = self.nixosConfigurations.Loki.config.home-manager.users.${user}.nixCats.out.packages.nvimStripped;
saint = final.callPackage ./packages/saint.nix {};
image-hct = final.callPackage ./packages/image-hct {};
})
];
/*
*
Function creates a package set for a given system architecture
with custom overlays and unfree package support enabled.
# Example
```nix
pkgs = mkPkgs "x86_64-linux"
```
# Type
mkPkgs :: String -> PkgSet
# Arguments
system
: System architecture string
# Details
The function:
- Imports the nixpkgs package set
- Applies custom overlays defined in the outer scope above
- Enables unfree package installation
- Returns a configured package set for the specified architecture
*/
mkPkgs = system:
import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
/*
*
Function creates a NixOS system configuration with integrated home-manager support and Catppuccin theme.
Allows for additional machine specific modules.
# Example
``` nix
mkSystem "laptop" [ ./additonal-module.nix ] "x86_64-linux
```
# Type
mkSystem :: String -> [Path] -> String -> NixosSystem
# Arguments
hostname
: The hostname of the target system
extraModules
: Additional NixOS modules to include
system
: The system architecture
# Details
The function combines:
- System-specific configuration from ./hosts/${hostname}
- Home-manager configuration from ./home/${user}/${hostname}.nix
- Catppuccin theme integration
- Any additional modules specified in extraModules
The resulting configuration inherits additional arguments defined in this flake (inputs, user).
*/
mkSystem = hostname: extraModules: system:
lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs user;
};
modules =
[
./hosts/${hostname}
home-manager.nixosModules.home-manager
{
home-manager = {
extraSpecialArgs = {
inherit inputs system user;
pkgs = mkPkgs system;
};
users.${user} = {
imports = [
./home/${user}/${hostname}.nix
catppuccin.homeManagerModules.catppuccin
];
};
};
}
]
++ extraModules;
};
in
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import inputs.systems;
perSystem = {system, ...}: {
# For bootstrapping
devShells =
import ./shell.nix
{
shellHook =
pre-commit-hooks.lib.${system}.run
{
src = ./.;
hooks = {
alejandra.enable = true;
statix.enable = true;
deadnix = {
enable = true;
args = ["--no-lambda-pattern-names"];
};
};
};
}
.shellHook;
packages = let
pkgs = mkPkgs system;
in {
saint = pkgs.callPackage ./packages/saint.nix {};
img-hct = pkgs.callPackage ./packages/image-hct {};
};
formatter = nixpkgs.legacyPackages.${system}.alejandra;
checks.pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
statix.enable = true;
deadnix = {
enable = true;
args = ["--no-lambda-pattern-names"];
};
};
# Custom packages or patched binaries not in nixpkgs
packages = let
pkgs = mkPkgs system;
in {
saint = pkgs.callPackage ./packages/saint.nix {};
nixCats = self.nixosConfigurations.Loki.config.home-manager.users.${user}.nixCats.out.packages.nvimFull;
nixCatsStripped = self.nixosConfigurations.Loki.config.home-manager.users.${user}.nixCats.out.packages.nvimStripped;
};
formatter = nixpkgs.legacyPackages.${system}.alejandra;
};
};
flake = {
nixosConfigurations = {
Loki = mkSystem "Loki" [] "x86_64-linux";
Medion = mkSystem "Medion" [] "x86_64-linux";
Fujitsu = mkSystem "Fujitsu" [] "x86_64-linux";
Wsl = mkSystem "Wsl" [] "x86_64-linux";
};
};
};
}