-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
260 lines (241 loc) · 8.36 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 = "
We still remember, we who dwell
In this far land beneath the trees
The starlight on the Western Seas.
";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
alejandra.url = "github:kamadorueda/alejandra/3.0.0";
alejandra.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-flatpak.url = "github:gmodena/nix-flatpak";
# nix-flatpak.inputs.nixpkgs.follows = "nixpkgs"; #
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# nixos-hardware.inputs.nixpkgs.follows = "nixpkgs"; #
impermanence.url = "github:nix-community/impermanence";
# impermanence.inputs.nixpkgs.follows = "nixpkgs"; #
nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
plasma-manager = {
url = "github:nix-community/plasma-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
sddmSugarCandy4Nix = {
url = "github:MOIS3Y/sddmSugarCandy4Nix";
inputs.nixpkgs.follows = "nixpkgs";
};
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
zen-browser.url = "github:ch4og/zen-browser-flake";
foundryvtt.url = "github:reckenrode/nix-foundryvtt";
};
outputs = {
self,
nixpkgs,
home-manager,
alejandra,
chaotic,
nix-flatpak,
nixos-hardware,
impermanence,
nixpkgs-wayland,
nix-index-database,
plasma-manager,
disko,
foundryvtt,
...
} @ inputs: let
inherit (self) outputs;
systems = [
"aarch64-linux"
# "i686-linux"
"x86_64-linux"
# "aarch64-darwin"
# "x86_64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems; # This is a function that generates an attribute by calling a function you pass to it, with each system as an argument
inheritSpecialArgs = {
inherit
self
inputs
outputs
nixos-hardware
impermanence
nix-flatpak
nixpkgs-wayland
;
};
# <system> is something like "x86_64-linux", "aarch64-linux", "i686-linux", "x86_64-darwin"
# <name> is an attribute name like "hello".
# <flake> is a flake name like "nixpkgs".
# <store-path> is a /nix/store.. path
in {
# # Executed by `nix flake check`
# checks."<system>"."<name>" = derivation;
# # Executed by `nix build .#<name>`
# packages."<system>"."<name>" = derivation;
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); # Custom packages accessible through 'nix build', 'nix shell', etc
# # Executed by `nix build .`
# packages."<system>".default = derivation;
# # Executed by `nix run .#<name>`
# apps."<system>"."<name>" = {
# type = "app";
# program = "<store-path>";
# };
# # Executed by `nix run . -- <args?>`
# apps."<system>".default = {
# type = "app";
# program = "...";
# };
# # Formatter (alejandra, nixfmt or nixpkgs-fmt)
# formatter."<system>" = derivation;
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); # Formatter for your nix files, available through 'nix fmt'.
# # Used for nixpkgs packages, also accessible via `nix build .#<name>`
# legacyPackages."<system>"."<name>" = derivation;
# # Overlay, consumed by other flakes
# overlays."<name>" = final: prev: {};
# # Default overlay
# overlays.default = final: prev: {};
overlays = import ./overlays {inherit inputs;};
# # Nixos module, consumed by other flakes
# nixosModules."<name>" = {config, ...}: {
# options = {};
# config = {};
# };
# # Default module
# nixosModules.default = {config, ...}: {
# options = {};
# config = {};
# };
nixosModules = import ./modules/nixos {flakes = inputs;}; # Reusable nixos modules.
# # Used with `nixos-rebuild switch --flake .#<hostname>`
# # nixosConfigurations."<hostname>".config.system.build.toplevel must be a derivation
# nixosConfigurations."<hostname>" = {};
nixosConfigurations = {
eris = nixpkgs.lib.nixosSystem {
specialArgs = inheritSpecialArgs;
modules = [
./hosts/eris.nix
self.nixosModules.default
chaotic.nixosModules.default
home-manager.nixosModules.home-manager
nix-flatpak.nixosModules.nix-flatpak
self.homeManagerConfig
disko.nixosModules.disko
];
};
# NixOS configuration entrypoint. Available through 'nixos-rebuild --flake .#sedna'
sedna = nixpkgs.lib.nixosSystem {
specialArgs = inheritSpecialArgs;
modules = [
./hosts/sedna.nix
self.nixosModules.default
chaotic.nixosModules.default
home-manager.nixosModules.home-manager
nix-flatpak.nixosModules.nix-flatpak
self.homeManagerConfig
];
};
thoughtful = nixpkgs.lib.nixosSystem {
specialArgs = inheritSpecialArgs;
modules = [
./hosts/thoughtful.nix
self.nixosModules.default
chaotic.nixosModules.default
home-manager.nixosModules.home-manager
nix-flatpak.nixosModules.nix-flatpak
self.homeManagerConfig
];
};
jupiter = nixpkgs.lib.nixosSystem {
specialArgs = inheritSpecialArgs;
modules = [
./hosts/jupiter.nix
self.nixosModules.default
chaotic.nixosModules.default
home-manager.nixosModules.home-manager
nix-flatpak.nixosModules.nix-flatpak
self.homeManagerConfig
disko.nixosModules.disko
inputs.foundryvtt.nixosModules.foundryvtt
];
};
};
# # Used by `nix develop .#<name>`
# devShells."<system>"."<name>" = derivation;
# # Used by `nix develop`
# devShells."<system>".default = derivation;
# # Hydra build jobs
# hydraJobs."<attr>"."<system>" = derivation;
# # Used by `nix flake init -t <flake>#<name>`
# templates."<name>" = {
# path = "<store-path>";
# description = "template description goes here?";
# };
# # Used by `nix flake init -t <flake>`
# templates.default = {
# path = "<store-path>";
# description = "";
# };
homeManagerModules = import ./modules/home-manager {flakes = inputs;}; # Reusable home-manager modules.
homeManagerConfig = {...}: {
nixpkgs.hostPlatform = nixpkgs.lib.mkDefault "x86_64-linux";
home-manager.extraSpecialArgs = inheritSpecialArgs;
home-manager.sharedModules = [
self.homeManagerModules.default # My custom modules
nix-index-database.hmModules.nix-index # nix-index-database
plasma-manager.homeManagerModules.plasma-manager # plasma-manager
];
};
homeConfigurations = {
# home-manager --flake .#teq@somewhere
"teq@somewhere" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
modules = [
self.homeManagerModules.default # My custom modules
nix-index-database.hmModules.nix-index # nix-index-database
{
teq.home-manager = {
enable = true;
};
}
];
};
};
devShells.x86_64-linux.thoughtful = let
buildInputs = with nixpkgs.legacyPackages.x86_64-linux; [
udev
alsa-lib
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr # To use the x11 feature
libxkbcommon
wayland # To use the wayland feature
openssl
pkg-config
];
in nixpkgs.legacyPackages.x86_64-linux.mkShell {
nativeBuildInputs = with nixpkgs.legacyPackages.x86_64-linux; [
gcc
pkg-config
cargo
rustc
rustup
rustfmt
rust-analyzer
bacon
clippy
];
buildInputs = buildInputs;
LD_LIBRARY_PATH = nixpkgs.legacyPackages.x86_64-linux.lib.makeLibraryPath buildInputs;
RUST_SRC_PATH = "${nixpkgs.legacyPackages.x86_64-linux.rust.packages.stable.rustPlatform.rustLibSrc}";
};
};
}