@@ -9,8 +9,48 @@ as possible.
99If you have problems or feedback, feel free to join [ the
1010discord] ( https://discord.gg/n9ga99KwWC ) .
1111
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+ ```
1454
1555## Options
1656
@@ -20,12 +60,12 @@ The documentation for the options can be found
2060## Features
2161
2262- ** 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; `
2464- ** Automatic Directories, Users and Permissions:** The module automatically
2565 creates directories and users for your media library. It also sets sane
2666 permissions.
2767- ** 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/* `
2969- ** Optional Automatic Port Forwarding:** This module has a UPNP module that
3070 lets services request ports from your router automatically, if you enable it.
3171
@@ -42,7 +82,11 @@ nixarr.vpn = {
4282
4383## Examples
4484
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
4690
4791``` nix {.numberLines}
4892nixarr = {
@@ -63,7 +107,7 @@ nixarr = {
63107 enable = true;
64108 # These options set up a nginx HTTPS reverse proxy, so you can access
65109 # Jellyfin on your domain with HTTPS
66- expose = {
110+ expose.https = {
67111 enable = true;
68112 domainName = "your.domain.com";
69113 acmeMail = "[email protected] "; # Required for ACME-bot @@ -86,8 +130,14 @@ nixarr = {
86130};
87131```
88132
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"
91141
92142``` nix {.numberLines}
93143nixarr = {
@@ -100,13 +150,21 @@ nixarr = {
100150
101151 jellyfin = {
102152 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 = {
104158 enable = true;
105- # Access the Jellyfin web-ui from the internet
106- openWebPort = true;
159+ port = 12345;
107160 };
108161 };
109162
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+
110168 transmission = {
111169 enable = true;
112170 vpn.enable = true;
@@ -119,9 +177,43 @@ nixarr = {
119177 readarr.enable = true;
120178 lidarr.enable = true;
121179};
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
122207```
123208
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
125217
126218It's recommended that the VPN you're using has support for port forwarding. I
127219suggest [ AirVpn] ( https://airvpn.org/ ) , since they accept Monero, but you can
0 commit comments