-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.nix
More file actions
150 lines (131 loc) · 4.11 KB
/
server.nix
File metadata and controls
150 lines (131 loc) · 4.11 KB
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
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configurations/firewall.nix
./modules/common.nix
./modules/user.nix
./modules/headless.nix
];
networking.hostName = "changwang-cw56-58"; # Define your hostname.
services.xrdp.enable = true;
services.xrdp.defaultWindowManager = "xfce4-session";
services.xrdp.openFirewall = true;
age.secrets.user-password.file = ./secrets/user-password.age;
age.secrets.caddy-basicauth.file = ./secrets/caddy-basicauth.age;
systemd.services.caddy.serviceConfig = {
EnvironmentFile = config.age.secrets.caddy-basicauth.path;
};
services.caddy = {
enable = true;
extraConfig = ''
spaceheaterlab.net {
basicauth * {
{$HTTP_BASIC_AUTH_USER} {$HTTP_BASIC_AUTH_PASSWORD}
}
root * /srv/www
#handle /octoprint/* {
# rewrite * /
# reverse_proxy http://10.0.0.5:80 #{
# #header_up X-Scheme {scheme}
# #}
#}
file_server
encode gzip
}
radicale.spaceheaterlab.net {
reverse_proxy localhost:5232
}
'';
};
services.radicale = {
enable = true;
settings = {
server.hosts = [ "localhost:5232" ];
auth = {
type = "htpasswd";
htpasswd_filename = "/srv/radicale/htpasswd";
htpasswd_encryption = "bcrypt";
};
};
};
#services.jellyfin.enable = false;
#services.jellyseerr.enable = false;
#services.prowlarr.enable = false;
#services.radarr.enable = false;
#services.sonarr.enable = false;
#services.openvpn.servers = {
# # This leaks DNS request. It's just for proxying
# mullvad = {
# config = ''
# client
# dev tun
# resolv-retry infinite
# nobind
# persist-key
# persist-tun
# verb 3
# remote-cert-tls server
# ping 10
# ping-restart 60
# sndbuf 524288
# rcvbuf 524288
# cipher AES-256-GCM
# tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384
# proto udp
# auth-user-pass /run/agenix/openvpn-mullvad-userpass
# ca /run/agenix/openvpn-mullvad-ca
# tun-ipv6
# script-security 2
# fast-io
# remote-random
# remote 91.90.44.11 1196 # no-osl-ovpn-001
# remote 91.90.44.15 1196 # no-osl-ovpn-005
# remote 91.90.44.16 1196 # no-osl-ovpn-006
# remote 194.127.199.114 1196 # no-svg-ovpn-001
# remote 91.90.44.18 1196 # no-osl-ovpn-008
# remote 91.90.44.12 1196 # no-osl-ovpn-002
# remote 91.90.44.13 1196 # no-osl-ovpn-003
# remote 91.90.44.17 1196 # no-osl-ovpn-007
# remote 194.127.199.145 1196 # no-svg-ovpn-002
# remote 91.90.44.14 1196 # no-osl-ovpn-004
# route-nopull
# route 10.0.0.0 255.0.0.0
# '';
# };
#};
#services.transmission = {
# enable = false;
# settings = {
# watch-dir-enabled = true;
# watch-dir = "/srv/Shares/Transmission/Torrents";
# incomplete-dir-enabled = true;
# incomplete-dir = "/srv/Shares/Transmission/Incomplete";
# download-dir = "/srv/Shares/Transmission/Complete";
# };
#};
# Proxy transmission to split tunnel
# LEAKS IP
#systemd.services.transmission.environment.http_proxy = "socks5://10.8.0.1:1080";
networking.firewall = {
enable = true;
# Block any traffic that Transmission does not tunnel. WIP.
#extraCommands = ''
# #iptables -A OUTPUT -m owner --uid-owner transmission -i \! tun0 -j REJECT
#'';
allowedTCPPorts = [
# Blocky
53 # DNS
# For Caddy
80 # HTTP
443 # HTTPS
];
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}