-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
225 lines (215 loc) · 6.97 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
{
description = "Lan Tian's NixOS Flake";
inputs = {
# Common libraries
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-24-05.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
flake-parts.url = "github:hercules-ci/flake-parts";
flake-utils.url = "github:numtide/flake-utils";
agenix = {
url = "github:oluceps/agenix/with-sysuser";
inputs.home-manager.follows = "home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
cities-json = {
url = "github:lutangar/cities.json";
flake = false;
};
colmena = {
url = "github:zhaofengli/colmena";
inputs.flake-compat.follows = "flake-compat";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
inputs.stable.follows = "nixpkgs";
};
composer2nix = {
url = "github:svanderburg/composer2nix";
flake = false;
};
dwarffs.url = "github:edolstra/dwarffs";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
nil = {
url = "github:oxalica/nil";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
nix-alien = {
url = "github:thiagokokada/nix-alien";
inputs.flake-compat.follows = "flake-compat";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-gaming = {
url = "github:fufexan/nix-gaming";
inputs.flake-parts.follows = "flake-parts";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-math = {
url = "github:xddxdd/nix-math";
inputs.flake-parts.follows = "flake-parts";
inputs.nixpkgs.follows = "nixpkgs";
};
nixd = {
url = "github:nix-community/nixd";
inputs.flake-parts.follows = "flake-parts";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nur.url = "github:nix-community/NUR";
nur-xddxdd = {
# url = "/home/lantian/Projects/nur-packages";
url = "github:xddxdd/nur-packages";
inputs.flake-parts.follows = "flake-parts";
inputs.nix-index-database.follows = "nix-index-database";
inputs.nvfetcher.follows = "nvfetcher";
};
nvfetcher = {
url = "github:berberman/nvfetcher";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.flake-compat.follows = "flake-compat";
};
proxmox-nixos = {
url = "github:xddxdd/proxmox-nixos";
inputs.utils.follows = "flake-utils";
inputs.flake-compat.follows = "flake-compat";
};
secrets = {
# url = "/home/lantian/Projects/nixos-secrets";
url = "github:xddxdd/nixos-secrets";
inputs.flake-parts.follows = "flake-parts";
inputs.nixpkgs.follows = "nixpkgs";
};
srvos = {
url = "github:nix-community/srvos";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self, flake-parts, ... }@inputs:
let
inherit (inputs.nixpkgs) lib;
LT = import ./helpers {
inherit lib inputs self;
};
in
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
./flake-modules/commands.nix
./flake-modules/nixd.nix
./flake-modules/nixos-configurations.nix
inputs.nur-xddxdd.flakeModules.auto-colmena-hive-v0_20241006
inputs.nur-xddxdd.flakeModules.commands
inputs.nur-xddxdd.flakeModules.lantian-pre-commit-hooks
inputs.nur-xddxdd.flakeModules.lantian-treefmt
inputs.nur-xddxdd.flakeModules.nixpkgs-options
];
debug = true;
systems = [
"x86_64-linux"
"aarch64-linux"
];
flake = rec {
# Export for nixos-secrets
inherit lib LT;
exportPkgs = self.pkgs;
buildCommands =
let
buildCommandFor = lib.concatMapStringsSep " " (
host: ".#nixosConfigurations.${host}.config.system.build.toplevel"
);
hostsWithTag =
tag: builtins.attrNames (lib.filterAttrs (_n: v: builtins.elem tag (LT.tagsForHost v)) LT.hosts);
in
{
all = buildCommandFor (builtins.attrNames LT.hosts);
x86_64-linux = buildCommandFor (hostsWithTag "x86_64-linux");
};
ipv4List = builtins.concatStringsSep "\n" (
lib.filter (v: v != "") (lib.mapAttrsToList (_k: v: v.public.IPv4) LT.hosts)
);
ipv6List = builtins.concatStringsSep "\n" (
lib.filter (v: v != "") (lib.mapAttrsToList (_k: v: v.public.IPv6) LT.hosts)
);
};
nixpkgs-options =
let
permittedInsecurePackages = [ ];
overlays =
let
rpi_dt_ao_overlay = _final: prev: {
deviceTree = prev.deviceTree // {
applyOverlays = _final.callPackage (
inputs.nixos-hardware + "/raspberry-pi/4/apply-overlays-dtmerge.nix"
) { };
};
};
in
[
inputs.agenix.overlays.default
inputs.colmena.overlay
inputs.nil.overlays.nil
inputs.nix-alien.overlays.default
inputs.nixd.overlays.default
inputs.nur.overlay
inputs.nur-xddxdd.overlays.inSubTree-pinnedNixpkgs
inputs.nvfetcher.overlays.default
inputs.proxmox-nixos.overlays.x86_64-linux
inputs.secrets.overlays.default
rpi_dt_ao_overlay
]
++ (import ./overlays { inherit inputs; });
in
{
pkgs = {
sourceInput = inputs.nixpkgs;
patches = LT.ls ./patches/nixpkgs;
inherit permittedInsecurePackages overlays;
};
pkgs-stable = {
sourceInput = inputs.nixpkgs-stable;
patches = LT.ls ./patches/nixpkgs-stable;
inherit permittedInsecurePackages overlays;
};
};
perSystem =
{ config, pkgs, ... }:
let
LT = import ./helpers {
inherit lib inputs self;
inherit pkgs;
};
in
{
packages = rec {
# DNSControl
dnscontrol-config =
pkgs.writeText "dnsconfig.js"
(lib.evalModules {
modules = [ ./dns/default.nix ];
specialArgs = {
inherit
pkgs
lib
LT
inputs
;
};
}).config._dnsconfig_js;
};
};
};
}