mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 23:55:37 +00:00
add jellyfin, switch caddy to one listener
This commit is contained in:
parent
b4ba0706c0
commit
f196f546b8
@ -10,6 +10,7 @@ nixpkgs.lib.nixosSystem {
|
|||||||
{
|
{
|
||||||
networking.hostName = "oracle";
|
networking.hostName = "oracle";
|
||||||
bookServer = "books.masu.rs";
|
bookServer = "books.masu.rs";
|
||||||
|
streamServer = "stream.masu.rs";
|
||||||
gui.enable = false;
|
gui.enable = false;
|
||||||
colorscheme = (import ../../modules/colorscheme/gruvbox);
|
colorscheme = (import ../../modules/colorscheme/gruvbox);
|
||||||
passwordHash = null;
|
passwordHash = null;
|
||||||
@ -23,5 +24,6 @@ nixpkgs.lib.nixosSystem {
|
|||||||
../../modules/services/oracle.nix
|
../../modules/services/oracle.nix
|
||||||
../../modules/services/sshd.nix
|
../../modules/services/sshd.nix
|
||||||
../../modules/services/calibre.nix
|
../../modules/services/calibre.nix
|
||||||
|
../../modules/services/jellyfin.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ let
|
|||||||
in {
|
in {
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
caddyServers = lib.mkOption {
|
caddyRoutes = lib.mkOption {
|
||||||
type = lib.types.attrs;
|
type = lib.types.listOf lib.types.attrs;
|
||||||
description = "Caddy JSON configs for http servers";
|
description = "Caddy JSON routes for http servers";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -16,8 +16,12 @@ in {
|
|||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
adapter = "''"; # Required to enable JSON
|
adapter = "''"; # Required to enable JSON
|
||||||
configFile = pkgs.writeText "Caddyfile"
|
configFile = pkgs.writeText "Caddyfile" (builtins.toJSON {
|
||||||
(builtins.toJSON { apps.http.servers = config.caddyServers; });
|
apps.http.servers.main = {
|
||||||
|
listen = [ ":443" ];
|
||||||
|
routes = config.caddyRoutes;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,9 +28,7 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
caddyServers.calibre = {
|
caddyRoutes = [{
|
||||||
listen = [ ":443" ];
|
|
||||||
routes = [{
|
|
||||||
match = [{ host = [ config.bookServer ]; }];
|
match = [{ host = [ config.bookServer ]; }];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "reverse_proxy";
|
||||||
@ -38,7 +36,6 @@ in {
|
|||||||
headers.request.add."X-Script-Name" = [ "/calibre-web" ];
|
headers.request.add."X-Script-Name" = [ "/calibre-web" ];
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall.interfaces.calibre = { allowedTCPPorts = [ 80 443 ]; };
|
networking.firewall.interfaces.calibre = { allowedTCPPorts = [ 80 443 ]; };
|
||||||
|
|
||||||
|
23
modules/services/jellyfin.nix
Normal file
23
modules/services/jellyfin.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{ config, lib, ... }: {
|
||||||
|
|
||||||
|
options = {
|
||||||
|
streamServer = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for Jellyfin library";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
|
||||||
|
services.jellyfin.enable = true;
|
||||||
|
|
||||||
|
caddyRoutes = [{
|
||||||
|
match = [{ host = [ config.streamServer ]; }];
|
||||||
|
handle = [{
|
||||||
|
handler = "reverse_proxy";
|
||||||
|
upstreams = [{ dial = "localhost:8096"; }];
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user