-
Notifications
You must be signed in to change notification settings - Fork 3
/
options.nix
222 lines (194 loc) · 6.31 KB
/
options.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
{
inputs ? (with builtins; (getFlake (toString ./.)).inputs),
config,
pkgs,
lib,
...
}:
with lib;
let
myLib = (import ./lib/extended.nix lib).my;
inherit (pkgs.stdenv) isLinux isDarwin;
cfg = config.my;
mkOpt = type: default: mkOption { inherit type default; };
pathStr =
with types;
coercedTo path toString str
// {
check = x: isString x && builtins.substring 0 1 x == "/";
};
in
{
options.my = with types; {
email = mkOpt (nullOr str) "[email protected]";
homepage = mkOpt str "https://loganlinn.com";
github.username = mkOpt str "loganlinn";
environment.variables = mkOpt (attrsOf str) { };
user = {
name = mkOpt str "logan";
description = mkOpt str "Logan Linn";
home = mkOpt str (if isDarwin then "/Users/${cfg.user.name}" else "/home/${cfg.user.name}");
shell = mkOpt (either str package) pkgs.zsh;
packages = mkOpt (listOf package) [ ];
openssh.authorizedKeys.keys = mkOpt (listOf str) [ ];
};
home = with lib.types; {
file = mkOpt' attrs { } "Files to place directly in $HOME";
configFile = mkOpt' attrs { } "Files to place in $XDG_CONFIG_HOME";
dataFile = mkOpt' attrs { } "Files to place in $XDG_DATA_HOME";
fakeFile = mkOpt' attrs { } "Files to place in $XDG_FAKE_HOME";
binDir = mkOpt str "${cfg.my.user.home}/.local/bin";
cacheDir = mkOpt str "${cfg.my.user.home}/.cache";
configDir = mkOpt str "${cfg.my.user.home}/.config";
dataDir = mkOpt str "${cfg.my.user.home}/.local/share";
stateDir = mkOpt str "${cfg.my.user.home}/.local/state";
fakeDir = mkOpt str "${cfg.my.user.home}/.local/user";
};
pubkeys.ssh = mkOpt (attrsOf str) { };
# homeModules = mkOpt (listOf raw) [ ];
# nixosModules = mkOpt (listOf raw) [ ];
# darwinModules = mkOpt (listOf raw) [ ];
# userDirs = mkOpt (with types; attrsOf (nullOr pathType)) { };
fonts = {
serif = mkOption { type = myLib.types.font; };
sans = mkOption { type = myLib.types.font; };
mono = mkOption { type = myLib.types.font; };
terminal = mkOption { type = myLib.types.font; };
nerdfonts = {
fonts = mkOpt (listOf str) [ ];
package = mkOption {
type = package;
readOnly = true;
default = pkgs.nerdfonts.override { fonts = cfg.fonts.nerdfonts.fonts; };
};
};
packages = mkOpt (listOf package) [ ];
};
nix.registry = mkOption {
type = myLib.types.nix-registry;
default = { };
};
nix.settings = mkOption {
type =
let
confAtom =
nullOr (oneOf [
bool
int
float
str
path
package
])
// {
description = "Nix config atom (null, bool, int, float, str, path or package)";
};
in
attrsOf (either confAtom (listOf confAtom));
};
};
config = {
my = {
pubkeys.ssh.ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINGpyxX1xNYCJHLpTQAEorumej3kyNWlknnhQ/QqkhdN ${cfg.email}";
pubkeys.ssh.rsa = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/IGTiUT57yPpsCHcSo0FUUBY7uTZL87vdr7EqE+fS+6FQFZbhXuzy63Y13+ssN1Cbwy7hE3I4u0HgaXnhe8Ogr+buvBYqcSCajbN8j2vVVy/WUuGRPKyczk0bZpL1V7LUt98jBMnctirVeY0YoBgEk9POWHZ4NTTK0Bsr2WAwpWUkdYPcHpEIW+ABNX4YqxZdq7ETMy18ELfE/IJz04/+9rGHvpsDLL2SXDJCj+hxofW28SaqncOv/GvTN9gpkQGpUfHbxMyHz8Xj3faiguCN70dFEUb1FVL5ilxePSp/hOYx039idGT+K5oojutT6gH8p1K2uQ12rO+auvmKVSrh ${cfg.email}";
user = {
openssh.authorizedKeys.keys = attrValues cfg.pubkeys.ssh;
packages = with pkgs; [
curl
jq
fd
ripgrep
gh
];
};
environment.variables = {
DOTFILES_DIR = "${cfg.user.home}/.dotfiles";
DISABLE_TELEMETRY = "1";
DOCKER_SCAN_SUGGEST = "false";
DOTNET_CLI_TELEMETRY_OPTOUT = "true";
DO_NOT_TRACK = "1";
FLAKE_CHECKER_NO_TELEMETRY = "true";
NIX_INSTALLER_DIAGNOSTIC_ENDPOINT = "";
TELEMETRY_DISABLED = "1";
};
# userDirs = mkDefault {
# desktop = "Desktop";
# documents = "Documents";
# download = "Downloads";
# music = "Music";
# pictures = "Pictures";
# publicShare = "Public";
# videos = "Videos";
# screenshots = "Screenshots";
# code = "src";
# dotfiles = ".dotfiles";
# };
fonts = {
serif = mkDefault {
package = pkgs.dejavu_fonts;
name = "DejaVu Serif";
size = mkDefault (if isLinux then 10 else 12);
};
sans = mkDefault {
package = pkgs.dejavu_fonts;
name = "DejaVu Sans";
size = mkDefault (if isLinux then 10 else 12);
};
mono = mkDefault {
package = pkgs.dejavu_fonts;
name = "DejaVu Sans Mono";
size = mkDefault (if isLinux then 10 else 12);
};
terminal = mkDefault {
package = cfg.fonts.nerdfonts.package;
name = "FiraCode Nerd Font Light";
size = mkDefault (if isLinux then 11 else 12);
};
nerdfonts.fonts = mkDefault [
"DejaVuSansMono"
"FiraCode"
"FiraMono"
"Iosevka"
"JetBrainsMono"
"NerdFontsSymbolsOnly"
"VictorMono"
];
packages = with pkgs; [
cfg.fonts.serif.package
cfg.fonts.sans.package
cfg.fonts.mono.package
cfg.fonts.terminal.package
cfg.fonts.nerdfonts.package
dejavu_fonts
cascadia-code
fira # sans
fira-code
fira-code-symbols
iosevka
material-design-icons # https://materialdesignicons.com/
material-icons
monaspace
noto-fonts
noto-fonts-emoji
open-sans
recursive
victor-mono
];
};
nix.settings = {
warn-dirty = mkDefault false;
show-trace = mkDefault true;
trusted-users = [ cfg.user.name ];
trusted-substituters = [
"https://loganlinn.cachix.org"
"https://nix-community.cachix.org"
];
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
};
};
};
}