-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
292 lines (259 loc) · 7.57 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
## vim: set fenc=utf-8 ts=2 sw=0 sts=0 sr et si tw=0 fdm=marker fmr={{{,}}}:
##
## NixOS flake by Andy3153
## created 02/12/23 ~ 15:17:52
## rewrote 15/03/24 ~ 16:56:09
##
{
description = "Andy3153's Nix flake";
# {{{ Inputs
inputs =
{
# {{{ NixPkgs
# NixPkgs Unstable
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# NixPkgs 24.11
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
# NixPkgs for TiLP
nixpkgs-tilp.url = "github:nixos/nixpkgs/0be46d0515c69cddaea4c4e01b62e2a318c379b4";
# NixPkgs (my fork for when I'm working on something)
#nixpkgs-andy3153.url = "github:Andy3153/nixpkgs/hunspell-ro_RO";
#nixpkgs-andy3153.url = "git+file:////home/andy3153/src/nixos/nixpkgs/?ref=hunspell-ro_RO";
# }}}
# {{{ My Nix packages
my-nixpkgs =
{
url = "github:Andy3153/my-nixpkgs";
#url = "git+file:///home/andy3153/src/nixos/my-nixpkgs";
inputs.nixpkgs.follows = "nixpkgs";
};
# }}}
# {{{ NixOS Hardware
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
#nixos-hardware.url = "github:Andy3153/nixos-hardware/asus-fx506hm_nvidia-open";
#nixos-hardware.url = "git+file:///home/andy3153/src/nixos/nixos-hardware/?ref=asus-fx506hm_nvidia-open";
# }}}
# {{{ Lanzaboote
lanzaboote =
{
url = "github:nix-community/lanzaboote/v0.4.1";
inputs.nixpkgs.follows = "nixpkgs";
};
# }}}
# {{{ programs.sqlite for Nix Flakes
flake-programs-sqlite =
{
url = "github:wamserma/flake-programs-sqlite";
inputs.nixpkgs.follows = "nixpkgs";
};
# }}}
# {{{ in-nix (add envvar when in `nix shell`)
in-nix =
{
url = "github:viperML/in-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# }}}
# {{{ Nix-Flatpak
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.3.0";
# }}}
# {{{ Home-Manager
home-manager =
{
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-stable =
{
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
# }}}
};
# }}}
# {{{ Outputs
outputs = inputs@
# {{{ Inputs
{
self,
nixpkgs,
nixpkgs-stable,
nixpkgs-tilp,
#nixpkgs-andy3153,
my-nixpkgs,
nixos-hardware,
lanzaboote,
flake-programs-sqlite,
in-nix,
nix-flatpak,
home-manager,
home-manager-stable,
...
}: rec
# }}}
{
# {{{ NixOS configurations
nixosConfigurations =
{
# {{{ sparkle | ASUS TUF F15 FX506HM
sparkle = nixpkgs.lib.nixosSystem
{
specialArgs = { inherit inputs; }; # access inputs in config
modules =
[
{ networking.hostName = "sparkle"; } # Hostname
# {{{ Add flake inputs to configuration
(
{ config, ... }:
{
_module.args =
{
pkgs-unstable = import nixpkgs { config = config.nixpkgs.config; };
pkgs-stable = import nixpkgs-stable { config = config.nixpkgs.config; };
pkgs-tilp = import nixpkgs-tilp { config = config.nixpkgs.config; };
my-pkgs = my-nixpkgs.packages.x86_64-linux;
};
}
)
# }}}
nixos-hardware.nixosModules.asus-fx506hm
lanzaboote.nixosModules.lanzaboote
flake-programs-sqlite.nixosModules.programs-sqlite
nix-flatpak.nixosModules.nix-flatpak
home-manager.nixosModules.home-manager
./hosts/sparkle
];
};
# }}}
# {{{ ember | Raspberry Pi 4
ember = nixpkgs-stable.lib.nixosSystem
{
specialArgs = { inherit inputs; }; # access inputs in config
modules =
[
{ networking.hostName = "ember"; } # Hostname
# {{{ Add flake inputs to configuration
(
{ config, ... }:
{
_module.args =
{
pkgs-unstable = import nixpkgs { config = config.nixpkgs.config; };
pkgs-stable = import nixpkgs-stable { config = config.nixpkgs.config; };
};
}
)
# }}}
# {{{ Dummy modules so I don't have to import inputs I don't need
(
{ options, lib, ... }:
let
dummyOpt = lib.mkOption { type = lib.types.anything; default = null; };
in
{
options =
{
boot.lanzaboote = dummyOpt;
services.flatpak.overrides = dummyOpt;
services.flatpak.packages = dummyOpt;
services.flatpak.update = dummyOpt;
};
}
)
# }}}
"${nixpkgs-stable}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
nixos-hardware.nixosModules.raspberry-pi-4
flake-programs-sqlite.nixosModules.programs-sqlite
home-manager-stable.nixosModules.home-manager
./hosts/ember
];
};
# {{{ Configuration for `ember` host when made into an SD card image
ember-image = self.nixosConfigurations.ember.extendModules
{
modules = [ { disabledModules =
[
# These apply to the already-installed system and its custom
# partitioning, we need to disable this for the image creation
./hosts/ember/hardware-configuration.nix
]; } ];
};
# }}}
# }}}
# {{{ livecd | Live CD
livecd = nixpkgs.lib.nixosSystem
{
specialArgs = { inherit inputs; }; # access inputs in config
system = "x86_64-linux";
modules =
[
{ networking.hostName = "nixos-live"; } # Hostname
# {{{ Add flake inputs to configuration
(
{ config, ... }:
{
_module.args =
{
pkgs-unstable = import nixpkgs { config = config.nixpkgs.config; };
pkgs-stable = import nixpkgs-stable { config = config.nixpkgs.config; };
my-pkgs = my-nixpkgs.packages.x86_64-linux;
};
}
)
# }}}
# {{{ Dummy modules so I don't have to import inputs I don't need
(
{ options, lib, ... }:
let
dummyOpt = lib.mkOption { type = lib.types.anything; default = null; };
in
{
options =
{
boot.lanzaboote = dummyOpt;
};
}
)
# }}}
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
flake-programs-sqlite.nixosModules.programs-sqlite
nix-flatpak.nixosModules.nix-flatpak
home-manager.nixosModules.home-manager
./hosts/livecd
];
};
# }}}
};
# }}}
# {{{ Images
images =
{
ember = nixosConfigurations.ember-image.config.system.build.sdImage;
};
# }}}
# {{{ Templates
templates = rec
{
default = devenv-empty;
# {{{ Development environments
# {{{ Empty
devenv-empty =
{
path = ./templates/devenv/empty;
description = "Empty development environment";
};
# }}}
# {{{ Python
devenv-python =
{
path = ./templates/devenv/python;
description = "Python development environment";
};
devenv-py = devenv-python;
# }}}
# }}}
};
# }}}
};
# }}}
}