-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
234 lines (231 loc) · 6.8 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
{
inputs = {
# to allow non-nix 2.4 evaluation
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
# better than nixpkgs.lib
std = {
url = "github:chessai/nix-std";
};
# Nixpkgs/NixOS
nixpkgs.url = "nixpkgs/nixos-unstable";
# utils
utils.url = "github:numtide/flake-utils";
# deployments
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs = {
flake-compat.follows = "flake-compat";
nixpkgs.follows = "nixpkgs";
utils.follows = "utils";
};
};
# self-explanatory
home-manager = {
url = "github:nix-community/home-manager";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
# NixOS-WSL
nixos-wsl = {
url = "github:nix-community/NixOS-WSL";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "utils";
flake-compat.follows = "flake-compat";
};
};
# ragenix
ragenix.url = "github:yaxitech/ragenix";
ragenix.inputs.nixpkgs.follows = "nixpkgs";
# nixos-vscode-server
nixos-vscode-server.url = "github:msteen/nixos-vscode-server";
nixos-vscode-server.flake = false;
# nixneovimplugins
nixneovimplugins = {
url = "github:NixNeovim/NixNeovimPlugins";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "utils";
};
};
# tree
tree.url = "github:kittywitch/tree";
# impermanence
impermanence.url = "github:nix-community/impermanence";
# fenix
#fenix.url = "github:nix-community/fenix";
#fenix.inputs.nixpkgs.follows = "nixpkgs";
# arcnmx/nixfiles
arcexprs.url = "github:arcnmx/nixexprs";
arcexprs.flake = false;
# devenv
#devenv.url = "github:cachix/devenv/latest";
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:danth/stylix";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
};
};
};
outputs = inputs @ {
self,
nixpkgs,
utils,
...
}: let
mkTree = inputs.tree.tree;
tree = mkTree {
inherit inputs;
folder = ./.;
config = {
"/" = {
excludes = [
"flake"
"default"
"tree"
"inputs"
"outputs"
"pkgs"
"repl"
"shell"
];
};
"profiles/base".functor.enable = true;
"profiles/gui".functor.enable = true;
"profiles/wsl".functor = {
enable = true;
external = [
(import inputs.nixos-wsl).nixosModules.wsl
];
};
"modules/home".functor = {
enable = true;
external = [
inputs.impermanence.nixosModules.home-manager.impermanence
(import (inputs.arcexprs + "/modules")).home-manager
inputs.nix-index-database.hmModules.nix-index
];
};
"modules/system".functor.enable = true;
"packages/*".aliasDefault = true;
"services/*".aliasDefault = true;
"users/youko".functor.enable = true;
"users/celeste/*".functor.enable = true;
};
};
nixfiles = tree.impure;
root = ./.;
#overlays = import nixfiles.overlays {inherit inputs system; };
in
{
inherit tree;
nixosConfigurations = with nixpkgs.lib;
listToAttrs (
map
(host:
nameValuePair host (nixosSystem {
system = "x86_64-linux"; # TODO: i mean they all are still for now but (android?)
specialArgs =
{
inherit inputs root;
tree = nixfiles;
flake = self;
}
// nixfiles;
modules = [
# The host
nixfiles.hosts.${host}.configuration
# General defaults
{system.configurationRevision = mkIf (self ? rev) self.rev;}
# base profile
nixfiles.profiles.base
# Home manager
inputs.home-manager.nixosModules.home-manager
{
# global home manager
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
verbose = true;
# Pass flake inputs deeper
extraSpecialArgs =
{
inherit inputs root;
tree = nixfiles;
flake = self;
}
// nixfiles;
sharedModules = [
nixfiles.modules.home
# error: undefined variable 'isNixpkgsStable'
{disabledModules = [(inputs.arcexprs + "/modules/home/imv.nix")];}
#{ home.packages = [ inputs.ragenix.packages."x86_64-linux".ragenix ]; }
];
};
}
# arcexprs
(import (inputs.arcexprs + "/modules")).nixos
# ragenix
inputs.ragenix.nixosModules.age
# impermanence
inputs.impermanence.nixosModules.impermanence
# VSCode remote fixer
(inputs.nixos-vscode-server + "/modules/vscode-server/default.nix")
# stylix
inputs.stylix.nixosModules.stylix
];
}))
[
"amaterasu"
/*
"okami"
*/
"star"
] #(nixpkgs.lib.attrNames treated.hosts)
);
deploy = with inputs.deploy-rs.lib.x86_64-linux; {
sshOpts = ["-p" "62954"];
nodes = {
amaterasu = {
hostname = "amaterasu.wg.foxgirl.tech";
profiles.system = {
user = "root";
path = activate.nixos self.nixosConfigurations.amaterasu;
};
};
star = {
hostname = "star.wg.foxgirl.tech";
profiles.system = {
user = "root";
path = activate.nixos self.nixosConfigurations.star;
};
};
};
};
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
}
// utils.lib.eachDefaultSystem (system: let
overlays = import nixfiles.overlays {
inherit inputs;
tree = nixfiles;
};
pkgs = import inputs.nixpkgs {
inherit system overlays;
};
in {
devShells.default = import ./shell.nix {
inherit pkgs;
hosts = builtins.attrNames nixfiles.hosts;
};
legacyPackages = pkgs;
});
}