-
Notifications
You must be signed in to change notification settings - Fork 8
/
configuration.nix##hostname.nipsu
319 lines (280 loc) · 7.46 KB
/
configuration.nix##hostname.nipsu
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
{ lib, config, pkgs, ... }:
{
imports = [
./common.nix
];
networking.hostName = "nipsu";
system.stateVersion = "21.03";
# UEFI boot
boot.loader.systemd-boot.enable = true;
#boot.loader.grub.grubDevice = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_2TB_S4X1NE0MA03611M";
swapDevices = [
{
device = "/media/swapfile";
size = 4096;
}
];
# Use local checkout of nixpkgs
nix.nixPath = [
"nixpkgs=/etc/nixpkgs"
"nixos-config=/etc/nixos/configuration.nix"
];
nixpkgs.jellyfinMediaPlayerEnv = {
# Jellyfin Media Player requires older driver on nipsu, otherwise video
# playback is super slow (no hardware acceleration?)
LIBVA_DRIVER_NAME = "i965";
};
# Monero daemon P2P and RPC ports
networking.firewall = {
allowedTCPPorts = [ 18080 18081 ];
};
users.predefinedUsers = {
# Add those users to syncthing group that you want to be able to access
# (read-only) those files.
jluttine = [ "wheel" "syncthing" "media" ];
meri = [ "syncthing" "media" ];
};
# Put root home directory under a backed up partition.
users.users.root.home = lib.mkForce "/var/lib/root";
services = {
matrix-synapse = {
enable = false;
# NOTE: The configuration for Matrix Synapse is in services/matrix.nix file
};
calibre-web = {
enable = true;
openFirewall = false;
listen.ip = "127.0.0.1";
options = {
# NOTE: This needs to be a string, otherwise the path is copied to nix
# store
calibreLibrary = "/var/lib/calibre-web/library";
enableBookConversion = true;
enableBookUploading = true;
};
};
nginx.virtualHosts."kirjahylly.nipsu.fi" = {
enableACME = true;
forceSSL = true;
# Increase upload limits. Note that calibre-web has its own limits in
# addition to these nginx limits:
# https://github.com/janeczku/calibre-web/issues/452
extraConfig = ''
client_max_body_size 300M;
send_timeout 300s;
'';
locations = {
"/" = {
proxyPass = "http://127.0.0.1:8083/";
};
};
};
syncthing = {
enable = true;
defaultVersioning = {
type = "trashcan";
params.cleanoutDays = "30";
};
};
printServer = {
enable = true;
};
mopidy = {
enable = false;
};
tuhlaajapojat = {
enable = true;
mailserver = {
enable = true;
};
};
bayesleague = {
enable = true;
};
tv = {
enable = false;
domain = "tv.nipsu.fi";
ssl = true;
};
media = {
enable = true;
domain = "media.nipsu.fi";
ssl = true;
};
diskrsync = {
enable = true;
compress = false;
snapshotName = "lv-nixos-var-snapshot";
volumeGroupName = "vg-nixos-var";
logicalVolumeName = "lv-nixos-var";
host = "[email protected]";
filename = "/home/users/jluttine/siilo/nipsu.img";
startAt = "01:00";
};
radicale = {
enable = true;
virtualHost = "paivyri.nipsu.fi";
ssl = true;
# Create/modify htpasswd file with:
# htpasswd -B radicale-passwords username
htpasswd = lib.readFile ./passwords/radicale-passwords;
};
emptyDomain = {
enable = true;
domain = "nipsu.fi";
};
# SSH server
openssh = {
enable = true;
ports = [6662];
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
};
};
# Tiny tiny RSS server
tt-rss = {
enable = true;
virtualHost = "feed.nipsu.fi";
# MySQL didn't work, see: https://github.com/NixOS/nixpkgs/issues/35469
database.type = "pgsql";
};
monero = {
enable = true;
mining = {
enable = false;
};
limits = {
download = 200;
upload = 100;
};
rpc = {
#address = "0.0.0.0";
#address = "127.0.0.1";
#
# NOTE: There's no SSL verification support in wallets, so we cannot
# rely on SSL, so we cannot use login credentials, so we cannot use this
# outside intranet securely, so we shouldn't open the port in the
# router.
#
# TODO: Set up SSL on both the node and the clients, then use
# credentials.
#
# NOTE: This is the binding address, so it can't be 127.0.0.1 or other
# machines won't be able to connect to it.
address = "192.168.10.10";
port = 18081;
restricted = true;
ssl = {
enable = true;
};
};
#extraConfig = ''
# confirm-external-bind=1
#'';
extraConfig = ''
confirm-external-bind=1
in-peers=4
out-peers=4
'';
};
# nginx.virtualHosts."monero.nipsu.fi" = {
# enableACME = true;
# forceSSL = true;
# listen = [
# {
# addr = "0.0.0.0";
# port = 80;
# ssl = false;
# }
# {
# addr = "0.0.0.0";
# port = 443;
# ssl = true;
# }
# {
# addr = "0.0.0.0";
# port = 18089;
# ssl = true;
# }
# ];
# locations = {
# "/" = {
# proxyPass = "http://localhost:18088/";
# };
# };
# };
# If you ever need to change this, manual migration is required, otherwise
# the new version will have empty database. See:
# https://nixos.org/manual/nixos/stable/index.html#module-services-postgres-upgrading
# There is an existing script for v9->v11 upgrade under /var/lib/postgresql
postgresql.package = pkgs.postgresql_15;
# DNS for dynamic IP
ddclient = let
account = import ./passwords/ddclient-account.nix;
in {
enable = true;
server = "api.cloudflare.com/client/v4";
username = account.username;
passwordFile = account.passwordFile;
protocol = "cloudflare";
domains = [];
# The default web API stopped working with SSL
usev4 = "web, web=api.ipify.org/, web-skip=''";
# nixpkgs doesn't support multiple zones so we have to use extraConfig
extraConfig = let
cfg = {
"nipsu.fi" = [ "nipsu.fi" ];
"tuhlaajapojat.fi" = [ "tuhlaajapojat.fi" ];
};
in lib.concatStrings (
lib.mapAttrsToList (
zone: domains: let
domainsString = lib.concatStringsSep "," domains;
in ''
zone=${zone}
${domainsString}
''
) cfg
);
};
xserver = {
# # SDDM fails at least on nipsu with video projector. See:
# #
# # https://github.com/sddm/sddm/issues/699
# #
# # https://wiki.archlinux.org/index.php/SDDM#Screen_resolution_is_too_low
#
# # This would solve it:
#
# extraConfig = ''
# [General]
# EnableHiDPI=false
# '';
displayManager.lightdm.enable = true;
desktopManager.plasma5.enable = true;
};
};
programs = {
mosh.enable = true;
weechat.enable = true;
direnv.enable = true;
};
environment.systemPackages = with pkgs; [
# Doom Emacs stuff
emacs
ripgrep
fd
# Disk space analysis
ncdu
# Sync video for among multiple clients
syncplay
# VLC was failing on July 23, 2020. Dragon seemed to work fine.
dragon
# Disk usage analysis on the command-line
ncdu
vlc
# Run w_scan2 -f c -c FI --output-VLC > /home/jluttine/channels.xspf
w_scan2
];
}