@@ -9,8 +9,48 @@ as possible.
9
9
If you have problems or feedback, feel free to join [ the
10
10
discord] ( https://discord.gg/n9ga99KwWC ) .
11
11
12
- Note that this is still in a somewhat alpha state, bugs are around and
13
- options are still subject to change, but the general format won't change.
12
+ Note that this is still in a somewhat alpha state, beware!
13
+
14
+ - Bugs are around
15
+ - Options are still subject to change
16
+ - Some options are mostly untested
17
+
18
+ The general format won't change however. If you do still use it, any feedback
19
+ is greatly appreciated.
20
+
21
+ ## Importing this module
22
+
23
+ To use this module, add it to your flake inputs in your nix flake file:
24
+
25
+ ``` nix {.numberLines}
26
+ {
27
+ description = "Your nix flake";
28
+
29
+ inputs = {
30
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
31
+ nixarr.url = "github:rasmus-kirk/nixarr";
32
+ };
33
+
34
+ outputs = {
35
+ nixpkgs,
36
+ nixarr,
37
+ ...
38
+ }@inputs: {
39
+ nixosConfigurations = {
40
+ servarr = nixpkgs.lib.nixosSystem {
41
+ system = "x86_64-linux";
42
+
43
+ modules = [
44
+ ./nixos/servarr/configuration.nix
45
+ nixarr.nixosModules.default
46
+ ];
47
+
48
+ specialArgs = { inherit inputs; };
49
+ };
50
+ };
51
+ };
52
+ }
53
+ ```
14
54
15
55
## Options
16
56
@@ -20,12 +60,12 @@ The documentation for the options can be found
20
60
## Features
21
61
22
62
- ** Run services through a VPN:** You can run any service that this module
23
- supports through a VPN, fx ` nixarr.* .vpn.enable = true; `
63
+ supports through a VPN, fx ` nixarr.transmission .vpn.enable = true; `
24
64
- ** Automatic Directories, Users and Permissions:** The module automatically
25
65
creates directories and users for your media library. It also sets sane
26
66
permissions.
27
67
- ** State Management:** All services support state management and all state
28
- that they manage is by default in ` /data/.state/nixarr/* `
68
+ that they manage is located by default in ` /data/.state/nixarr/* `
29
69
- ** Optional Automatic Port Forwarding:** This module has a UPNP module that
30
70
lets services request ports from your router automatically, if you enable it.
31
71
@@ -42,7 +82,11 @@ nixarr.vpn = {
42
82
43
83
## Examples
44
84
45
- Full example can be seen below:
85
+ This example does the following:
86
+
87
+ - Runs a jellyfin server and exposes it to the internet with HTTPS support.
88
+ - Runs the transmission torrent client through a vpn
89
+ - Runs all "* Arrs" supported by this module
46
90
47
91
``` nix {.numberLines}
48
92
nixarr = {
@@ -63,7 +107,7 @@ nixarr = {
63
107
enable = true;
64
108
# These options set up a nginx HTTPS reverse proxy, so you can access
65
109
# Jellyfin on your domain with HTTPS
66
- expose = {
110
+ expose.https = {
67
111
enable = true;
68
112
domainName = "your.domain.com";
69
113
acmeMail = "[email protected] "; # Required for ACME-bot
@@ -86,8 +130,14 @@ nixarr = {
86
130
};
87
131
```
88
132
89
- Another example where port forwarding is not an option. This could be useful
90
- for example if you're living in a dorm without access to port forwarding:
133
+ Another example where port forwarding is not an option. This is useful if,
134
+ for example, you're living in a dorm that does not allow port forwarding. This
135
+ example does the following:
136
+
137
+ - Runs Jellyfin and exposes it to the internet on a set port
138
+ - Starts openssh and runs it through the VPN so that it can be accessed
139
+ outside your home network
140
+ - Runs all the supported "* Arrs"
91
141
92
142
``` nix {.numberLines}
93
143
nixarr = {
@@ -100,13 +150,21 @@ nixarr = {
100
150
101
151
jellyfin = {
102
152
enable = true;
103
- vpn = {
153
+ vpn.enable = true;
154
+
155
+ # Access the Jellyfin web-ui from the internet.
156
+ # Get this port from your VPN provider
157
+ expose.vpn = {
104
158
enable = true;
105
- # Access the Jellyfin web-ui from the internet
106
- openWebPort = true;
159
+ port = 12345;
107
160
};
108
161
};
109
162
163
+ # Setup SSH service that runs through VPN.
164
+ # Lets you connect through ssh from the internet without having access to
165
+ # port forwarding
166
+ openssh.vpn.enable = true;
167
+
110
168
transmission = {
111
169
enable = true;
112
170
vpn.enable = true;
@@ -119,9 +177,43 @@ nixarr = {
119
177
readarr.enable = true;
120
178
lidarr.enable = true;
121
179
};
180
+
181
+ # The `openssh.vpn.enable` option does not enable openssh, so we do that here:
182
+ # We disable password authentication as it's generally insecure.
183
+ services.openssh = {
184
+ enable = true;
185
+ settings.PasswordAuthentication = false;
186
+ # Get this port from your VPN provider
187
+ ports = [ 54321 ]
188
+ };
189
+ # Adds your public keys as trusted devices
190
+ users.extraUsers.username.openssh.authorizedKeys.keyFiles = [
191
+ ./path/to/public/key/machine.pub}
192
+ ];
193
+ ```
194
+
195
+ In both examples, you don't have access to the "* Arrs" or torrent client
196
+ without being on your home network or accessing them through localhost. If
197
+ you have SSH setup you can use SSH tunneling. Simply run:
198
+
199
+ ``` sh
200
+ ssh -N user@ip \
201
+ -L 6001:localhost:9091 \
202
+ -L 6002:localhost:9696 \
203
+ -L 6003:localhost:8989 \
204
+ -L 6004:localhost:7878 \
205
+ -L 6005:localhost:8686 \
206
+ -L 6006:localhost:8787
122
207
```
123
208
124
- ## VPN
209
+ Replace ` user ` with your user and ` ip ` with the public ip, or domain if set
210
+ up, of your server. This lets you access the services on ` localhost:6000 `
211
+ through ` localhost:6006 ` .
212
+
213
+ Another solution is to use [ tailscale] ( https://tailscale.com/ ) or to setup
214
+ your own VPN [ manually with wireguard] ( https://nixos.wiki/wiki/WireGuard ) .
215
+
216
+ ## VPN Providers
125
217
126
218
It's recommended that the VPN you're using has support for port forwarding. I
127
219
suggest [ AirVpn] ( https://airvpn.org/ ) , since they accept Monero, but you can
0 commit comments