2
2
mirror of https://git.feal.no/felixalb/nixos-config.git synced 2025-01-28 12:20:50 +01:00

Compare commits

..

No commits in common. "af4c91cf2dfc09554921f2c69975ae897e4c9a40" and "fc52b62427ced389ad03c66152e8a8a0487d1afa" have entirely different histories.

4 changed files with 52 additions and 63 deletions

View File

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

View File

@ -6,16 +6,10 @@ let
in {
services = {
nginx.virtualHosts.${domain} = {
locations = {
"/".proxyPass = "http://${cfg.listen.ip}:${toString cfg.listen.port}";
"/opds".proxyPass = "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;
'';
locations."/".proxyPass =
"http://${cfg.listen.ip}:${toString cfg.listen.port}";
locations."/opds".proxyPass =
"http://${cfg.listen.ip}:${toString cfg.listen.port}";
};
calibre-server = {
@ -32,7 +26,6 @@ in {
options = {
calibreLibrary = storage;
enableBookConversion = true;
enableKepubify = true;
enableBookUploading = true;
};
};

View File

@ -1,45 +1,61 @@
{ config, pkgs, lib, ... }:
{
let
domainName = "jellyfin.home.feal.no";
in {
# Jellyfin - Media Streaming platform
services.jellyfin.enable = true;
users.users.${config.services.jellyfin.user}.extraGroups = [ "video" "render" ];
systemd.services.jellyfin.serviceConfig = {
DeviceAllow = lib.mkForce [ "/dev/dri/card0" ];
};
services.nginx.virtualHosts."jellyfin.home.feal.no" = {
services.nginx.virtualHosts."${domainName}" = {
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 = ''
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
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;
'';
};
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
location = / {
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

@ -1,19 +0,0 @@
{ 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;
};
}