-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdefault.nix
201 lines (192 loc) · 6.24 KB
/
default.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
{
self,
withSystem,
inputs,
...
}:
let
inherit (builtins) attrValues removeAttrs;
mkDarwin =
name:
{
system ? "aarch64-darwin",
user ? self.users.default,
stateVersion ? 4,
homeManagerStateVersion ? "24.05",
modules ? [ ],
}:
withSystem system (
ctx:
inputs.nix-darwin.lib.darwinSystem {
inherit (ctx) system;
specialArgs = {
inherit inputs;
};
modules =
attrValues self.commonModules
++ attrValues self.darwinModules
++ [
# Composed home-manager configuration.
inputs.home-manager.darwinModules.home-manager
(
{ pkgs, config, ... }:
{
inherit (ctx) nix;
mouseless.enable = true;
mouseless.wm = "aerospace";
homebrew.enable = true;
_module.args = ctx.extraModuleArgs;
nixpkgs = removeAttrs ctx.nixpkgs [ "hostPlatform" ];
system.stateVersion = stateVersion;
users.primaryUser = user;
networking.hostName = name;
networking.computerName = name;
environment.systemPackages = ctx.basePackagesFor pkgs;
# `home-manager` config
users.users.${user.username} = {
home = "/Users/${user.username}";
shell = pkgs.fish;
};
home-manager.backupFileExtension = ".backup-before-nix-home-manager";
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit (ctx.extraModuleArgs)
colors
color
icons
branches
;
};
home-manager.users.${user.username} = {
imports = attrValues self.homeManagerModules ++ [
inputs.sops.homeManagerModules.sops
(
{ ... }:
{
home.sessionVariables.EDITOR = "nvim";
home.sessionVariables.OPENAI_API_KEY = "$(cat ~/.config/sops-nix/secrets/openai_api_key)";
}
)
];
home.enableNixpkgsReleaseCheck = false;
home.stateVersion = homeManagerStateVersion;
home.user-info = user;
home.username = user.username;
home.packages = [
pkgs.sops
self.packages.${system}.nvim
config.nix.package
];
sops.gnupg.home = "~/.gnupg";
sops.gnupg.sshKeyPaths = [ ];
sops.defaultSopsFile = ../../secrets/secret.yaml;
sops.secrets.openai_api_key.path = "%r/openai_api_key";
sops.secrets.codeium.path = "%r/codeium";
# git diff integrations
programs.git.extraConfig.diff.sopsdiffer.textconv = "sops -d --config /dev/null";
programs.terminal.use = "ghostty";
};
}
)
]
++ modules;
}
);
mkDarwinConfigurations = configurations: builtins.mapAttrs mkDarwin configurations;
mkDroidConfiguration =
{
system,
modules ? [ ],
}:
withSystem system (
ctx:
inputs.nix-on-droid.lib.nixOnDroidConfiguration {
inherit (ctx) pkgs;
modules = [
{
nix = {
inherit (ctx.nix)
nixPath
registry
package
;
extraOptions = ''
experimental-features = nix-command flakes pipe-operators
'';
};
}
] ++ modules;
}
);
in
{
flake.users = {
default = rec {
username = "r17";
fullName = "Rin";
email = "[email protected]";
nixConfigDirectory = "/Users/${username}/.config/nixpkgs";
within = {
neovim.enable = false;
gpg.enable = true;
pass.enable = true;
};
};
};
# nix-darwin configurations
flake.darwinConfigurations = mkDarwinConfigurations {
eR17 = { };
eR17x = {
modules = [
{
nix.settings.builders-use-substitutes = true;
nix.linux-builder = {
enable = true;
ephemeral = true;
maxJobs = 4;
config = {
virtualisation = {
darwin-builder = {
diskSize = 40 * 1024;
memorySize = 8 * 1024;
};
cores = 6;
};
nix.settings.sandbox = false;
users.users.root.openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDKvi3Co5fB1dSU2Qs1sR6LwdB1hM6HCyIWfXsC0wgz1pmeFlje24SzPCxDtsVMq28fDpEBsXPqKSZbUIyBtHRnpIc72Z8IV0KNtBjbKQTfHLTiDu43e+VLuAdFE7u2Wf5KPQIQ52r/jr9P7UKU2GKwV016OzrRiaZjm+gixmd8YRfidzG1bsL5fbKBjxCIUROdVpW5kNNtPZHpeuHCkZ7341USC6V2qnp1BNHIoHLjRYosV82apOxN/AWY/tMN2jlVQ/gKIUHbxXoILsG+XRFCen5TSSearx54KxifI1aIWbxVVmmYNuLXGWnVumaH6U7ARpz2cEXQB9z2lvJGYmod8qfloVdjXESu8OFe4RT+nj0JUQs7pMhiN6K1AsMQiyFc0ZmU2UNx4JcHre5STnSKUHUCx4zzoToFvIQRBTB3HePHy74FcXWaYDAN/6YF3JEA203nyYL4o5m/KhSXNkcT3H+r3IAqKnl7J7obsvNowwa1UB2NxVmq0VXXR8uZlT0="
];
};
};
nix.settings.trusted-users = [ "@admin" ];
}
];
};
};
flake.nixOnDroidConfigurations.default = mkDroidConfiguration rec {
system = "aarch64-linux";
modules = [
(
{ pkgs, ... }:
{
system.stateVersion = "24.05";
home-manager.backupFileExtension = "backup-before-nix";
home-manager.useGlobalPkgs = true;
home-manager.config = {
home.stateVersion = "24.05";
home.packages = [
pkgs.coreutils
pkgs.gnused
pkgs.gawk
self.packages.${system}.nvim
];
imports = [
self.homeManagerModules.r17-shell
];
};
}
)
];
};
}