-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
241 lines (226 loc) · 8.13 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
{
description = "dotfiles";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
cachix-deploy-flake.url = "github:cachix/cachix-deploy-flake";
darwin.url = "github:lnl7/nix-darwin";
disko.url = "github:nix-community/disko";
emacs-overlay.url = "github:nix-community/emacs-overlay";
flake-parts.url = "github:hercules-ci/flake-parts";
git-hooks.url = "github:cachix/git-hooks.nix";
home-manager.url = "github:nix-community/home-manager";
impermanence.url = "github:nix-community/impermanence";
lanzaboote.url = "github:nix-community/lanzaboote";
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
niri-flake.url = "github:sodiboo/niri-flake";
nix-colors.url = "github:misterio77/nix-colors";
nix-on-droid.url = "github:nix-community/nix-on-droid";
nix-wallpaper.url = "github:natsukium/nix-wallpaper/custom-logo";
nixos-wsl.url = "github:nix-community/nixos-wsl";
nur-packages.url = "github:natsukium/nur-packages";
sops-nix.url = "github:Mic92/sops-nix";
treefmt-nix.url = "github:numtide/treefmt-nix";
tsnsrv.url = "github:boinkor-net/tsnsrv";
# used in follows
flake-utils.url = "github:numtide/flake-utils";
cachix-deploy-flake.inputs.darwin.follows = "darwin";
cachix-deploy-flake.inputs.disko.follows = "disko";
cachix-deploy-flake.inputs.home-manager.follows = "home-manager";
cachix-deploy-flake.inputs.nixos-anywhere.follows = "";
cachix-deploy-flake.inputs.nixpkgs.follows = "nixpkgs";
darwin.inputs.nixpkgs.follows = "nixpkgs";
disko.inputs.nixpkgs.follows = "nixpkgs";
emacs-overlay.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
git-hooks.inputs.flake-compat.follows = "";
git-hooks.inputs.gitignore.follows = "";
git-hooks.inputs.nixpkgs-stable.follows = "nixpkgs";
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
lanzaboote.inputs.flake-compat.follows = "";
lanzaboote.inputs.flake-parts.follows = "flake-parts";
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
lanzaboote.inputs.pre-commit-hooks-nix.follows = "git-hooks";
neovim-nightly-overlay.inputs.flake-compat.follows = "";
neovim-nightly-overlay.inputs.flake-parts.follows = "flake-parts";
neovim-nightly-overlay.inputs.git-hooks.follows = "git-hooks";
neovim-nightly-overlay.inputs.hercules-ci-effects.follows = "";
neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs";
niri-flake.inputs.niri-stable.follows = "";
niri-flake.inputs.niri-unstable.follows = "";
niri-flake.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
niri-flake.inputs.nixpkgs.follows = "nixpkgs";
niri-flake.inputs.xwayland-satellite-stable.follows = "";
niri-flake.inputs.xwayland-satellite-unstable.follows = "";
nix-on-droid.inputs.home-manager.follows = "home-manager";
nix-on-droid.inputs.nix-formatter-pack.follows = "";
nix-on-droid.inputs.nixpkgs-docs.follows = "nixpkgs";
nix-on-droid.inputs.nixpkgs-for-bootstrap.follows = "nixpkgs";
nix-on-droid.inputs.nixpkgs.follows = "nixpkgs";
nix-wallpaper.inputs.flake-utils.follows = "flake-utils";
nix-wallpaper.inputs.nixpkgs.follows = "nixpkgs";
nix-wallpaper.inputs.pre-commit-hooks.follows = "git-hooks";
nixos-wsl.inputs.flake-compat.follows = "";
nixos-wsl.inputs.flake-utils.follows = "flake-utils";
nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";
nur-packages.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
tsnsrv.inputs.flake-parts.follows = "flake-parts";
tsnsrv.inputs.nixpkgs.follows = "nixpkgs";
};
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
outputs =
{ self, flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
imports = [
./flake-module.nix
inputs.git-hooks.flakeModule
inputs.treefmt-nix.flakeModule
];
hosts = {
# main laptop (m1 macbook air)
katavi = {
system = "aarch64-darwin";
};
# build server (m1 mac mini)
mikumi = {
system = "aarch64-darwin";
};
# laptop for work (m1 macbook pro)
work = {
system = "aarch64-darwin";
username = "tomoya.matsumoto";
};
# main desktop (intel core i5-12400F)
kilimanjaro = {
system = "x86_64-linux";
};
# WSL (dualboot with kilimanjaro)
arusha = {
system = "x86_64-linux";
};
# main server (intel N100)
manyara = {
system = "x86_64-linux";
};
# build server (OCI A1 Flex)
serengeti = {
system = "aarch64-linux";
};
# phone (pixel 7a)
android = {
system = "aarch64-linux";
platform = "android";
};
};
flake = {
overlays = import ./overlays { inherit inputs; };
templates = import ./templates;
};
perSystem =
{
config,
pkgs,
system,
...
}:
{
_module.args.pkgs = import self.inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ self.inputs.nur-packages.overlays.default ] ++ builtins.attrValues self.overlays;
};
checks = import ./tests {
inherit (self.inputs) nixpkgs;
inherit pkgs;
};
packages =
let
cachix-deploy-lib = inputs.cachix-deploy-flake.lib pkgs;
in
{
cachix-deploy = cachix-deploy-lib.spec {
agents = {
mikumi = self.darwinConfigurations.mikumi.config.system.build.toplevel;
};
};
};
pre-commit = {
check.enable = true;
settings = {
src = ./.;
hooks = {
actionlint.enable = true;
biome.enable = true;
lua-ls.enable = false;
nil.enable = true;
shellcheck.enable = true;
treefmt.enable = true;
typos = {
enable = true;
excludes = [
"secrets/default.yaml"
"secrets.yaml"
"systems/shared/hercules-ci/binary-caches.json"
];
settings.configPath = "typos.toml";
};
yamllint = {
enable = true;
excludes = [
"secrets/default.yaml"
"secrets.yaml"
];
settings.configData = "{rules: {document-start: {present: false}}}";
};
};
};
};
treefmt = {
projectRootFile = "flake.nix";
programs = {
biome.enable = true;
nixfmt.enable = true;
shfmt.enable = true;
stylua.enable = true;
taplo.enable = true;
terraform.enable = true;
yamlfmt.enable = true;
};
};
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [
nix-fast-build
sops
ssh-to-age
(terraform.withPlugins (p: [
p.aws
p.external
p.hydra
p.null
p.oci
p.sops
]))
];
shellHook = config.pre-commit.installationScript;
};
};
};
};
}