2
2
mirror of https://git.feal.no/felixalb/nixos-config.git synced 2025-01-15 14:34:48 +01:00

Compare commits

..

2 Commits

Author SHA1 Message Date
af4c91cf2d voyager: cleanup jellyfin config 2024-05-31 18:28:54 +02:00
eab8d95469 voyager: add komga, cleanup calibre 2024-05-31 16:48:43 +02:00
4 changed files with 64 additions and 53 deletions

View File

@ -10,15 +10,16 @@
./exports.nix ./exports.nix
./filesystems.nix ./filesystems.nix
./services/snappymail.nix
./services/calibre.nix ./services/calibre.nix
./services/fancontrol.nix ./services/fancontrol.nix
./services/jellyfin.nix ./services/jellyfin.nix
./services/kanidm.nix ./services/kanidm.nix
./services/komga.nix
./services/nextcloud.nix ./services/nextcloud.nix
./services/nginx ./services/nginx
./services/podgrab.nix ./services/podgrab.nix
./services/postgres.nix ./services/postgres.nix
./services/snappymail.nix
./services/timemachine.nix ./services/timemachine.nix
./services/transmission.nix ./services/transmission.nix
]; ];

View File

@ -6,10 +6,16 @@ let
in { in {
services = { services = {
nginx.virtualHosts.${domain} = { nginx.virtualHosts.${domain} = {
locations."/".proxyPass = locations = {
"http://${cfg.listen.ip}:${toString cfg.listen.port}"; "/".proxyPass = "http://${cfg.listen.ip}:${toString cfg.listen.port}";
locations."/opds".proxyPass = "/opds".proxyPass = "http://${cfg.listen.ip}:${toString cfg.listen.port}";
"http://${cfg.listen.ip}:${toString cfg.listen.port}"; };
extraConfig = ''
client_max_body_size 512M;
proxy_busy_buffers_size 512k;
proxy_buffers 4 512k;
proxy_buffer_size 256k;
'';
}; };
calibre-server = { calibre-server = {
@ -26,6 +32,7 @@ in {
options = { options = {
calibreLibrary = storage; calibreLibrary = storage;
enableBookConversion = true; enableBookConversion = true;
enableKepubify = true;
enableBookUploading = true; enableBookUploading = true;
}; };
}; };

View File

@ -1,61 +1,45 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let
domainName = "jellyfin.home.feal.no"; {
in {
# Jellyfin - Media Streaming platform # Jellyfin - Media Streaming platform
services.jellyfin.enable = true; services.jellyfin.enable = true;
users.users.${config.services.jellyfin.user}.extraGroups = [ "video" "render" ]; users.users.${config.services.jellyfin.user}.extraGroups = [ "video" "render" ];
systemd.services.jellyfin.serviceConfig = { systemd.services.jellyfin.serviceConfig = {
DeviceAllow = lib.mkForce [ "/dev/dri/card0" ]; DeviceAllow = lib.mkForce [ "/dev/dri/card0" ];
}; };
services.nginx.virtualHosts."${domainName}" = { services.nginx.virtualHosts."jellyfin.home.feal.no" = {
serverAliases = [ "jf.feal.no" ]; serverAliases = [ "jf.feal.no" ];
locations = {
"= /" = {
return = "302 http://$host/web/";
};
"/" = {
proxyPass = "http://127.0.0.1:8096";
extraConfig = ''
proxy_buffering off;
'';
};
"/socket" = {
proxyPass = "http://127.0.0.1:8096";
proxyWebsockets = true;
};
};
extraConfig = '' extraConfig = ''
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff"; add_header X-Content-Type-Options "nosniff";
location = / { add_header Permissions-Policy "accelerometer=(), ambient-light-sensor=(), battery=(), bluetooth=(), camera=(), clipboard-read=(), display-capture=(), document-domain=(), encrypted-media=(), gamepad=(), geolocation=(), gyroscope=(), hid=(), idle-detection=(), interest-cohort=(), keyboard-map=(), local-fonts=(), magnetometer=(), microphone=(), payment=(), publickey-credentials-get=(), serial=(), sync-xhr=(), usb=(), xr-spatial-tracking=()" always;
return 302 http://$host/web/;
#return 302 https://$host/web/;
}
location / {
# Proxy main Jellyfin traffic
proxy_pass http://127.0.0.1:8096;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
# Disable buffering when the nginx proxy gets very resource heavy upon streaming
proxy_buffering off;
}
# location block for /web - This is purely for aesthetics so /web/#!/ works instead of having to go to /web/index.html/#!/
location = /web/ {
# Proxy main Jellyfin traffic
proxy_pass http://127.0.0.1:8096/web/index.html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}
location /socket {
# Proxy Jellyfin Websockets traffic
proxy_pass http://127.0.0.1:8096;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}
''; '';
};
fileSystems."/tank/media/jellyfin/Music" = {
options = [ "bind" ];
device = "/tank/media/music";
}; };
} }

View File

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
let
domain = "komga.home.feal.no";
cfg = config.services.komga;
in {
services.nginx.virtualHosts.${domain} = {
locations."/".proxyPass = "http://127.0.0.1:${toString cfg.port}";
extraConfig = ''
client_max_body_size 512M;
'';
};
services.komga = {
enable = true;
stateDir = "/tank/media/komga";
port = 8034;
};
}