Add jellyfin host
This commit is contained in:
		
					parent
					
						
							
								8a16dd0af2
							
						
					
				
			
			
				commit
				
					
						693c6da88a
					
				
			
		
					 9 changed files with 141 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -34,6 +34,9 @@ in
 | 
			
		|||
    jackett = {
 | 
			
		||||
      site = "vs";
 | 
			
		||||
    };
 | 
			
		||||
    jellyfin = {
 | 
			
		||||
      site = "vs";
 | 
			
		||||
    };
 | 
			
		||||
    nitter = {
 | 
			
		||||
      site = "vs";
 | 
			
		||||
    };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								hosts/jellyfin/configuration.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								hosts/jellyfin/configuration.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  boot.loader.grub = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    device = "/dev/vda";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  networking = {
 | 
			
		||||
    hostName = "jellyfin";
 | 
			
		||||
    firewall = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      allowedTCPPorts = [ 80 443 ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  system.stateVersion = "23.05";
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								hosts/jellyfin/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								hosts/jellyfin/default.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./configuration.nix
 | 
			
		||||
    ./hardware-configuration.nix
 | 
			
		||||
    ./secrets.nix
 | 
			
		||||
    ./jellyfin.nix
 | 
			
		||||
    ./nginx.nix
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								hosts/jellyfin/hardware-configuration.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								hosts/jellyfin/hardware-configuration.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  fileSystems."/mnt/media" = {
 | 
			
		||||
    device = "//10.202.46.5/media";
 | 
			
		||||
    fsType = "cifs";
 | 
			
		||||
    options = [ 
 | 
			
		||||
      "username=jellyfin" 
 | 
			
		||||
      "credentials=/secrets/samba-credentials.secret"
 | 
			
		||||
      "iocharset=utf8"
 | 
			
		||||
      "vers=3.1.1"
 | 
			
		||||
      "uid=jellyfin"
 | 
			
		||||
      "gid=jellyfin"
 | 
			
		||||
      "_netdev"
 | 
			
		||||
    ];
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										6
									
								
								hosts/jellyfin/jellyfin.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								hosts/jellyfin/jellyfin.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  services.jellyfin = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										65
									
								
								hosts/jellyfin/nginx.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								hosts/jellyfin/nginx.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,65 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  services.nginx = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    virtualHosts."jellyfin.grzb.de" = {
 | 
			
		||||
      forceSSL = true;
 | 
			
		||||
      enableACME = true;
 | 
			
		||||
      listen = [
 | 
			
		||||
        {
 | 
			
		||||
          addr = "0.0.0.0";
 | 
			
		||||
          port = 80;
 | 
			
		||||
        }
 | 
			
		||||
        {
 | 
			
		||||
          addr = "0.0.0.0";
 | 
			
		||||
          port = 443;
 | 
			
		||||
          ssl = true;
 | 
			
		||||
        }
 | 
			
		||||
      ];
 | 
			
		||||
      locations."= /" = {
 | 
			
		||||
        return = "302 https://$host/web/";
 | 
			
		||||
      };
 | 
			
		||||
      locations."/" = {
 | 
			
		||||
        proxyPass = "http://localhost:8096/";
 | 
			
		||||
        extraConfig = ''
 | 
			
		||||
          # Disable buffering when the nginx proxy gets very resource heavy upon streaming
 | 
			
		||||
          proxy_buffering off;
 | 
			
		||||
        '';
 | 
			
		||||
      };
 | 
			
		||||
      locations."= /web/" = {
 | 
			
		||||
        proxyPass = "http://localhost:8096/web/index.html";
 | 
			
		||||
      };
 | 
			
		||||
      locations."/socket" = {
 | 
			
		||||
        proxyPass = "http://localhost:8096/socket";
 | 
			
		||||
        proxyWebsockets = true;
 | 
			
		||||
      };
 | 
			
		||||
      extraConfig = ''
 | 
			
		||||
        client_max_body_size 20M;
 | 
			
		||||
 | 
			
		||||
        # Security / XSS Mitigation Headers
 | 
			
		||||
        # NOTE: X-Frame-Options may cause issues with the webOS app
 | 
			
		||||
        add_header X-Frame-Options "SAMEORIGIN";
 | 
			
		||||
        add_header X-XSS-Protection "1; mode=block";
 | 
			
		||||
        add_header X-Content-Type-Options "nosniff";
 | 
			
		||||
 | 
			
		||||
        # COOP/COEP. Disable if you use external plugins/images/assets
 | 
			
		||||
        add_header Cross-Origin-Opener-Policy "same-origin" always;
 | 
			
		||||
        add_header Cross-Origin-Embedder-Policy "require-corp" always;
 | 
			
		||||
        add_header Cross-Origin-Resource-Policy "same-origin" always;
 | 
			
		||||
 | 
			
		||||
        # Permissions policy. May cause issues on some clients
 | 
			
		||||
        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;
 | 
			
		||||
 | 
			
		||||
        # Tell browsers to use per-origin process isolation
 | 
			
		||||
        add_header Origin-Agent-Cluster "?1" always;
 | 
			
		||||
 | 
			
		||||
        # Content Security Policy
 | 
			
		||||
        # See: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
 | 
			
		||||
        # Enforces https content and restricts JS/CSS to origin
 | 
			
		||||
        # External Javascript (such as cast_sender.js for Chromecast) must be whitelisted.
 | 
			
		||||
        # NOTE: The default CSP headers may cause issues with the webOS app
 | 
			
		||||
        #add_header Content-Security-Policy "default-src https: data: blob: http://image.tmdb.org; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' https://www.gstatic.com/cv/js/sender/v1/cast_sender.js https://www.gstatic.com/eureka/clank/95/cast_sender.js https://www.gstatic.com/eureka/clank/96/cast_sender.js https://www.gstatic.com/eureka/clank/97/cast_sender.js https://www.youtube.com blob:; worker-src 'self' blob:; connect-src 'self'; object-src 'none'; frame-ancestors 'self'";
 | 
			
		||||
      '';
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								hosts/jellyfin/secrets.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								hosts/jellyfin/secrets.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  deployment.keys."samba-credentials.secret" = {
 | 
			
		||||
    keyCommand = [ "env" "GNUPGHOME=/home/yuri/.passinfra_gnupg" "PASSWORD_STORE_DIR=/home/yuri/pass/infra" "pass" "jellyfin/samba-credentials" ];
 | 
			
		||||
    destDir = "/secrets";
 | 
			
		||||
    user = "root";
 | 
			
		||||
    group = "root";
 | 
			
		||||
    permissions = "0640";
 | 
			
		||||
    uploadAt = "pre-activation";
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								hosts/web-public-2/virtualHosts/acme-challenge.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								hosts/web-public-2/virtualHosts/acme-challenge.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  services.nginx.virtualHosts."jellyfin.grzb.de" = {
 | 
			
		||||
    listen = [{ 
 | 
			
		||||
      addr = "0.0.0.0";
 | 
			
		||||
      port = 80;
 | 
			
		||||
    }];
 | 
			
		||||
    locations."^~ /.well-known/acme-challenge/" = {
 | 
			
		||||
      proxyPass = "http://jellyfin.vs.grzb.de:80";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
{ ... }:
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ./acme-challenge.nix
 | 
			
		||||
    ./anisync.grzb.de.nix
 | 
			
		||||
    ./birdsite.nekover.se.nix
 | 
			
		||||
    ./element.nekover.se.nix
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue