blob: cd2c14838125daf6867a3453d8ca6798b38129a5 (
plain)
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
|
{ pkgs, lib, config, ... }: {
options.development.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "enables development";
};
config = lib.mkIf config.development.enable {
environment.systemPackages = with pkgs; [
jetbrains.idea-community
zed-editor
jetbrains.clion
# LSP
asm-lsp
astro-language-server
basedpyright
bash-language-server
vscode-langservers-extracted # html/css/json
gopls
lemminx # xml
lua-language-server
markdown-oxide
marksman
mdx-language-server
neocmakelsp
nil # nix
tailwindcss-language-server
taplo # toml
typescript-language-server
yaml-language-server
# pnpm i -g css-variables-language-server
# pnpm install -g gh-actions-language-server
jdt-language-server
kotlin-language-server
# Tools
stylua
gofumpt
golangci-lint
prettierd
jq
lldb # codelldb debugger
shellcheck
beautysh # shell formatter
gdb
nasm
rustup
tokei # count lines of code
go
pnpm
nodejs_24
clang
clang-tools
gcc
gnumake
goose
sqlc
maven
gradle
kotlin
mold # fast linker, for rust
gomodifytags
sops
go-tools # staticcheck
gosec
devtoolbox
busybox # A bunch of utils like lsof and fuser
cmake
libllvm
lld
file
universal-ctags
valgrind
prometheus
grafana-loki
grafana-alloy
pyroscope
];
# Grafana for eko
services.grafana.enable = true;
services.grafana.settings.server.http_port = 3030;
services.grafana.settings.smtp.enabled = true;
services.grafana.settings.smtp = {
host = "smtp.example.com:587";
user = "your@user.com";
password = "super-secret"; # Consider using a file for secret
skip_verify = true;
from_address = "your@user.com";
from_name = "Grafana";
startTLS_policy = "OpportunisticStartTLS";
};
systemd.services.grafana = {
serviceConfig = {
ProtectHome = lib.mkForce false;
ProtectSystem = lib.mkForce false;
PrivateTmp = lib.mkForce false;
ReadWritePaths = [ "/home/kyren/projects/eko" ];
};
};
# # Allow grafana to access DB
# fileSystems."/var/lib/grafana/eko" = {
# device = "/home/kyren/projects/eko";
# options = [ "bind" "ro" ];
# };
# Prometheus for eko
services.prometheus.enable = true;
services.prometheus.configText = builtins.readFile ./eko-prometheus.yml;
# Alloy service for eko
systemd.services.alloy = {
description = "Alloy";
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
reloadTriggers = lib.mapAttrsToList (_: v: v.source or null) (
lib.filterAttrs (n: _: lib.hasPrefix "alloy/" n && lib.hasSuffix ".alloy" n) config.environment.etc
);
serviceConfig = {
Restart = "always";
RestartSec = "2s";
User = "root"; # TODO: make these not root?
Group = "root";
SupplementaryGroups = [
# allow to read the systemd journal for loki log forwarding
"systemd-journal"
];
ConfigurationDirectory = "alloy";
StateDirectory = "alloy";
WorkingDirectory = "%S/alloy";
Type = "simple";
ExecStart = "${lib.getExe pkgs.grafana-alloy} run /etc/alloy/";
ExecReload = "${pkgs.coreutils}/bin/kill -SIGHUP $MAINPID";
};
};
environment.etc = {
"alloy/eko-config.alloy".text = builtins.readFile ./eko-config.alloy;
};
# Loki service for eko
services.loki.enable = true;
services.loki.configuration = {
auth_enabled = false;
server = {
http_listen_port = 3100;
};
common = {
ring = {
instance_addr = "127.0.0.1";
kvstore = {
store = "inmemory";
};
};
replication_factor = 1;
path_prefix = "/var/lib/loki";
};
schema_config = {
configs = [
{
from = "2020-05-15";
store = "tsdb";
object_store = "filesystem";
schema = "v13";
index = {
prefix = "index_";
period = "24h";
};
}
];
};
storage_config = {
filesystem = {
directory = "/var/lib/loki/chunks";
};
};
};
};
}
|