-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
251 lines (210 loc) · 8.68 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
{
description = "The nix-config of an Idiot";
nixConfig = {
extra-substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
"https://hyprland.cachix.org"
"https://anyrun.cachix.org"
];
extra-trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
];
};
outputs = inputs@{ self, nixpkgs, flake-parts, systems, ... }:
let
lib = inputs.nixpkgs.lib.extend (prev: _: import ./lib { lib = prev; });
mkPkgs = system: cuda: _rocm: import inputs.nixpkgs {
inherit system;
config = {
allowUnfree = true;
allowUnfreePredicate = _: true;
permittedInsecurePackages = [ ];
cudaSupport = cuda;
rocmSupport = false; # FIXME for some reason this is breaking shit when it shouldn't???
};
overlays = [
inputs.hyprland-contrib.overlays.default
inputs.lix-module.overlays.default
] ++ (builtins.attrValues (import ./overlays { inherit self inputs lib; }));
};
# TODO - Scan the folders for all the configurations and generate the list.
mkConfigurations = system:
let
mkBuilders = cuda: rocm: import ./lib/builders {
inherit self inputs lib;
pkgs = mkPkgs system cuda rocm;
};
builders = mkBuilders false false;
buildersWithCuda = mkBuilders true false;
buildersWithRocm = mkBuilders false true;
in
builtins.mapAttrs
(n: v:
if (builtins.hasAttr "acceleration" v) then
if (v.acceleration == "cuda") then buildersWithCuda.system.build system n v
else if (v.acceleration == "rocm") then buildersWithRocm.system.build system n v
else builders.system.build system n v
else builders.system.build system n v
)
{
nixe = {
users = [ "racci" ];
isoFormat = "iso";
deviceType = "desktop";
acceleration = "cuda";
};
winix = {
users = [ "racci" ];
isoFormat = "iso";
deviceType = "desktop";
acceleration = "cuda";
};
nixarr = {
isoFormat = "proxmox-lxc";
deviceType = "server";
acceleration = "rocm";
};
nixcloud = {
isoFormat = "proxmox-lxc";
deviceType = "server";
acceleration = "rocm";
};
nixdev = {
isoFormat = "proxmox-lxc";
deviceType = "server";
acceleration = "rocm";
};
nixio = {
isoFormat = "proxmox-lxc";
deviceType = "server";
acceleration = "rocm";
};
nixmon = {
isoFormat = "proxmox-lxc";
deviceType = "server";
acceleration = "rocm";
};
nixserv = {
isoFormat = "proxmox-lxc";
deviceType = "server";
acceleration = "rocm";
};
#|----------------------|
#| Deprecated Systems |
#|----------------------|
# surnix = {
# users = [ "racci" ];
# isoFormat = "iso";
# deviceType = "laptop";
# };
};
in
flake-parts.lib.mkFlake { inherit inputs; specialArgs.lib = lib; } {
imports = [
inputs.devenv.flakeModule
];
systems = [ "x86_64-linux" "aarch64-linux" ];
flake = let configurations = mkConfigurations builtins.currentSystem; in {
nixosConfigurations = builtins.mapAttrs (_n: v: v.system) configurations;
};
perSystem = { system, pkgs, ... }: {
_module.args.pkgs = mkPkgs system false false;
packages = import ./pkgs { inherit pkgs; };
devenv.shells.default = {
# Fixes https://github.com/cachix/devenv/issues/528
containers = lib.mkForce { };
packages = with pkgs; [
# Cli Tools
act # Github Action testing
hyperfine # Benchmarking
cocogitto # Conventional Commits
# Required Tools
nix
git
home-manager
# Secure Boot Debugging
sbctl
# Sops-nix
age
sops
ssh-to-age
];
languages = {
nix.enable = true;
};
pre-commit = {
hooks = {
typos = {
enable = true;
settings = {
diff = true;
ignored-words = [
"lazer"
"Optin"
"tere"
"ags"
];
exclude = "secrets.yaml";
};
};
editorconfig-checker.enable = true;
actionlint.enable = true;
nil.enable = true;
deadnix.enable = true;
nixpkgs-fmt.enable = true;
statix.enable = true;
};
};
env = {
NIX_CONFIG = "extra-experimental-features = nix-command flakes";
};
};
formatter = pkgs.nixpkgs-fmt;
};
};
inputs = {
# Flake Inputs
nixpkgs-lib.url = "github:nix-community/nixpkgs.lib";
# Packages
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR";
# Utils
flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; };
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
nixos-generators = { url = "github:nix-community/nixos-generators"; inputs = { nixlib.follows = "nixpkgs-lib"; nixpkgs.follows = "nixpkgs"; }; };
devenv = { url = "github:cachix/devenv"; inputs = { flake-compat.follows = "flake-compat"; }; };
# Base Modules
home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; };
nixos-hardware.url = "github:nixos/nixos-hardware";
sops-nix = { url = "github:Mic92/sops-nix"; inputs = { nixpkgs.follows = "nixpkgs"; nixpkgs-stable.follows = "nixpkgs"; }; };
impermanence.url = "github:nix-community/impermanence";
lanzaboote = { url = "github:nix-community/lanzaboote/v0.3.0"; inputs = { nixpkgs.follows = "nixpkgs"; flake-parts.follows = "flake-parts"; flake-compat.follows = "flake-compat"; }; };
nixd = { url = "github:nix-community/nixd"; inputs = { nixpkgs.follows = "nixpkgs"; flake-parts.follows = "flake-parts"; }; };
lix = { url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"; flake = false; };
lix-module = { url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz"; inputs = { nixpkgs.follows = "nixpkgs"; lix.follows = "lix"; }; };
stylix = { url = "github:danth/stylix?rev=762c07ee10b381bc8e085be5b6c2ec43139f13b0"; };
nix-alien = { url = "github:thiagokokada/nix-alien"; };
# Modules only used on some systems
nixos-wsl = { url = "github:nix-community/NixOS-WSL"; inputs = { nixpkgs.follows = "nixpkgs"; flake-compat.follows = "flake-compat"; }; };
jovian = { url = "github:Jovian-Experiments/Jovian-NixOS"; inputs.nixpkgs.follows = "nixpkgs"; };
nixarr = { url = "github:rasmus-kirk/nixarr"; };
# Desktop Stuff
hyprland = { url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; };
hyprland-plugins = { url = "github:hyprwm/hyprland-plugins"; inputs.hyprland.follows = "hyprland"; };
hyprland-contrib.url = "github:hyprwm/contrib";
anyrun = { url = "github:anyrun-org/anyrun"; inputs = { nixpkgs.follows = "nixpkgs"; flake-parts.follows = "flake-parts"; }; };
astal = { url = "github:aylur/astal"; inputs.nixpkgs.follows = "nixpkgs"; };
ags = { url = "github:aylur/ags"; inputs = { nixpkgs.follows = "nixpkgs"; astal.follows = "astal"; }; };
# Other misc modules
arion = { url = "github:hercules-ci/arion"; };
vscode-extensions = { url = "github:nix-community/nix-vscode-extensions"; inputs = { nixpkgs.follows = "nixpkgs"; flake-compat.follows = "flake-compat"; }; };
moza-racing = { url = "github:danerieber/moza-racing-wheel-nix"; };
# Resources
firefox-ultima = { url = "github:soulhotel/FF-ULTIMA"; flake = false; };
tinted-theming = { url = "github:tinted-theming/schemes"; flake = false; };
};
}