hosts/library: extract SSH tunnel config
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./grafana.nix
|
./grafana.nix
|
||||||
./prometheus.nix
|
./prometheus.nix
|
||||||
|
./tunnel.nix
|
||||||
../server.nix
|
../server.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -48,32 +49,6 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.vps1-tunnel = {
|
|
||||||
enable = true;
|
|
||||||
description = "vps1.mesh.vimium.net SSH tunnel";
|
|
||||||
after = [
|
|
||||||
"network-online.target"
|
|
||||||
"jellyfin.service"
|
|
||||||
];
|
|
||||||
wants = [ "network-online.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "simple";
|
|
||||||
ExecStart = pkgs.lib.mkForce ''
|
|
||||||
${pkgs.openssh}/bin/ssh \
|
|
||||||
-NT \
|
|
||||||
-o ExitOnForwardFailure=yes \
|
|
||||||
-o ServerAliveInterval=60 \
|
|
||||||
-o TCPKeepAlive=no \
|
|
||||||
-i %h/.ssh/id_jellyfin \
|
|
||||||
-R localhost:8000:localhost:8000 \
|
|
||||||
jellyfin@vps1.mesh.vimium.net
|
|
||||||
'';
|
|
||||||
Restart = "always";
|
|
||||||
RestartSec = 20;
|
|
||||||
};
|
|
||||||
wantedBy = [ "default.target" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
services.nginx =
|
services.nginx =
|
||||||
let
|
let
|
||||||
proxyConfig = ''
|
proxyConfig = ''
|
||||||
|
32
hosts/library/tunnel.nix
Normal file
32
hosts/library/tunnel.nix
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
systemd.services.vps1-tunnel = {
|
||||||
|
enable = true;
|
||||||
|
description = "vps1.mesh.vimium.net SSH tunnel";
|
||||||
|
after = [
|
||||||
|
"network-online.target"
|
||||||
|
"jellyfin.service"
|
||||||
|
];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = pkgs.lib.mkForce ''
|
||||||
|
${pkgs.openssh}/bin/ssh \
|
||||||
|
-NT \
|
||||||
|
-o ExitOnForwardFailure=yes \
|
||||||
|
-o ServerAliveInterval=60 \
|
||||||
|
-o TCPKeepAlive=no \
|
||||||
|
-i %h/.ssh/id_jellyfin \
|
||||||
|
-R localhost:8000:localhost:8000 \
|
||||||
|
jellyfin@vps1.mesh.vimium.net
|
||||||
|
'';
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = 20;
|
||||||
|
};
|
||||||
|
wantedBy = [ "default.target" ];
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user