feat: Added jellyfin reverse proxy

This commit is contained in:
uttarayan21
2025-07-13 05:02:55 +05:30
parent fa718f5618
commit 71228dd717
19 changed files with 173 additions and 64 deletions

View File

@@ -4,9 +4,9 @@
./skhd.nix
./tailscale.nix
./autossh.nix
./homeassistant.nix
# ./zerotier.nix
# ./jellyfin.nix
# ./homeassistant.nix
# ./aerospace.nix
];
}

View File

@@ -17,7 +17,7 @@
homeassistant.settings.services = {
homeassistant = {
service.image = "ghcr.io/home-assistant/home-assistant:stable";
service.volumes = ["/etc/localtime:/etc/localtime:ro" "/run/dbus:/run/dbus:ro"];
service.volumes = ["/etc/localtime:/etc/localtime:ro" "/run/dbus:/run/dbus:ro" "/var/lib/homeassistant:/config"];
service.privileged = true;
service.network_mode = "host";
service.restart = "unless-stopped";

View File

@@ -13,8 +13,7 @@
};
};
tsuba = {
hostname = "192.168.0.125";
# hostname = "tsuba.darksailor.dev";
hostname = "tsuba.darksailor.dev";
profiles.system = {
sshUser = "servius";
path = inputs.deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.tsuba;

22
flake.lock generated
View File

@@ -1262,6 +1262,27 @@
"type": "github"
}
},
"home-manager-stable": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1752208517,
"narHash": "sha256-aRY1cYOdVdXdNjcL/Twpa27CknO7pVHxooPsBizDraE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c6a01e54af81b381695db796a43360bf6db5702f",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.05",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
@@ -2578,6 +2599,7 @@
"ghostty": "ghostty",
"guihua": "guihua",
"home-manager": "home-manager",
"home-manager-stable": "home-manager-stable",
"hyprland": "hyprland",
"hyprlock": "hyprlock",
"ironbar": "ironbar",

View File

@@ -13,6 +13,10 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-stable = {
url = "github:nix-community/home-manager/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
@@ -189,6 +193,7 @@
self,
nixpkgs,
home-manager,
home-manager-stable,
nix-darwin,
flake-utils,
anyrun,
@@ -298,7 +303,7 @@
})
// (
import ./nixos/tsuba {
inherit inputs nixpkgs home-manager overlays nur nixos-raspberrypi;
inherit inputs nixpkgs home-manager-stable overlays nur nixos-raspberrypi;
devices = rpi_devices;
}
);
@@ -359,7 +364,7 @@
};
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [sops just];
packages = with pkgs; [sops just clang];
};
};
}

View File

@@ -0,0 +1,3 @@
{pkgs, ...}: {
home.packages = [pkgs.ddcbacklight];
}

View File

@@ -31,6 +31,8 @@
./zoxide.nix
./mpris-scrobbler.nix
./omnix.nix
# ./ddcbacklight.nix
./yt-dlp.nix
# ./magika.nix
# ./ncmpcpp.nix
# ./neomutt.nix
@@ -66,35 +68,13 @@
sd
tldr
vcpkg-tool
yt-dlp
]
++ lib.optionals (!device.isServer) [
clang
cmake
d2
devenv
go
hasklig
jujutsu
monaspace
nerd-fonts.fira-code
nerd-fonts.hasklug
nerd-fonts.symbols-only
qmk
ttyper
yarn
]
++ lib.optionals device.isLinux [
dig
gptfdisk
handlr-regex
handlr-xdg
lsof
ncpamixer
rr
sbctl
usbutils
ddcbacklight
]
++ lib.optionals device.isLinux []
++ lib.optionals device.isDarwin [];
}

3
home/programs/sbctl.nix Normal file
View File

@@ -0,0 +1,3 @@
{pkgs, ...}: {
home.packages = [pkgs.sbctl];
}

3
home/programs/yt-dlp.nix Normal file
View File

@@ -0,0 +1,3 @@
{pkgs, ...}: {
home.packages = [pkgs.yt-dlp];
}

View File

@@ -49,12 +49,6 @@
href = "https://prowlarr.tsuba.darksailor.dev";
};
}
{
"Jackett" = {
description = "Jackett";
href = "https://jackett.tsuba.darksailor.dev";
};
}
{
"Home Assistant" = {
description = "Home Automation";

View File

@@ -44,7 +44,7 @@
};
users.users.${device.user} = {
isNormalUser = true;
extraGroups = ["wheel"];
extraGroups = ["wheel" "media"];
initialPassword = "aaa";
openssh.authorizedKeys.keyFiles = [
../../secrets/id_ed25519.pub
@@ -57,6 +57,7 @@
../../secrets/id_ed25519.pub
];
};
users.groups.media = {};
system.stateVersion = "25.05";
services.openssh.enable = true;
}

View File

@@ -3,7 +3,7 @@
devices,
inputs,
overlays,
home-manager,
home-manager-stable,
nur,
nixos-raspberrypi,
...
@@ -18,9 +18,12 @@
};
system = device.system;
modules = [
inputs.arion.nixosModules.arion
inputs.disko.nixosModules.disko
nur.modules.nixos.default
inputs.sops-nix.nixosModules.sops
inputs.nix-minecraft.nixosModules.minecraft-servers
nur.modules.nixos.default
home-manager-stable.nixosModules.home-manager
{
nixpkgs.overlays = overlays;
imports = with nixos-raspberrypi.nixosModules; [
@@ -28,6 +31,19 @@
raspberry-pi-5.display-vc4
raspberry-pi-5.bluetooth
];
home-manager = {
backupFileExtension = "bak";
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
inherit device;
stablePkgs = inputs.nixpkgs-stable.legacyPackages.${device.system};
};
users.${device.user}.imports = [
../../home
];
};
}
./configuration.nix
./services

View File

@@ -133,6 +133,9 @@ in {
type = "filesystem";
format = "ext4";
mountpoint = "/volumes/media";
mountOptions = [
"nofail"
];
};
};
};

View File

@@ -20,6 +20,7 @@
propagation_timeout -1
propagation_delay 120s
dns hetzner {env.HETZNER_API_KEY}
resolvers 1.1.1.1
}
}
'';

View File

@@ -9,5 +9,6 @@
# ./radarr.nix
# ./prowlarr.nix
./deluge.nix
./homeassistant.nix
];
}

View File

@@ -0,0 +1,57 @@
{
pkgs,
lib,
...
}: {
virtualisation.docker.enable = true;
users.extraUsers.servius.extraGroups = ["docker"];
services.caddy = {
virtualHosts."home.darksailor.dev".extraConfig = ''
import hetzner
reverse_proxy localhost:8123
'';
};
# environment.systemPackages = [pkgs.arion pkgs.docker pkgs.podman];
# virtualisation.podman.enable = true;
# virtualisation.podman.dockerSocket.enable = true;
# # networking.firewall.allowedTCPPorts = [21063 21064];
# # networking.firewall.allowedUDPPorts = [5353];
#
# virtualisation.arion = {
# backend = "podman-socket";
# projects = {
# homeassistant.settings.services = {
# homeassistant = {
# service.image = "ghcr.io/home-assistant/home-assistant:stable";
# service.volumes = ["/etc/localtime:/etc/localtime:ro" "/run/dbus:/run/dbus:ro" "/var/lib/homeassistant:/config"];
# service.privileged = true;
# service.network_mode = "host";
# service.restart = "unless-stopped";
# };
# };
# };
# };
}
# {
# virtualisation.podman.enable = true;
# virtualisation.podman.dockerSocket.enable = true;
# users.extraUsers.servius.extraGroups = ["podman"];
# networking.firewall.enable = false;
# virtualisation.oci-containers = {
# backend = "podman";
# containers.homeassistant = {
# # environment.TZ = "Asia/Kolkata";
# # Note: The image will not be updated on rebuilds, unless the version label changes
# image = "ghcr.io/home-assistant/home-assistant:stable";
# volumes = ["/etc/localtime:/etc/localtime:ro" "/run/dbus:/run/dbus:ro" "/var/lib/homeassistant:/config"];
# extraOptions = [
# # Use the host network namespace for all sockets
# "--network=host"
# # Pass devices into the container, so Home Assistant can discover and make use of them
# "--device=/dev/ttyACM0:/dev/ttyACM0"
# ];
# };
# };
# }

View File

@@ -1,12 +1,12 @@
{...}: {
# services = {
# jellyseerr.enable = true;
# jellyfin.enable = true;
# caddy = {
# virtualHosts."jellyfin.tsuba.darksailor.dev".extraConfig = ''
# import hetzner
# reverse_proxy localhost:8096
# '';
# };
# };
services = {
jellyseerr.enable = true;
# jellyfin.enable = true;
caddy = {
virtualHosts."jellyfin.tsuba.darksailor.dev".extraConfig = ''
import hetzner
reverse_proxy localhost:8096
'';
};
};
}

View File

@@ -1,23 +1,44 @@
{
unstablePkgs,
config,
lib,
...
}: let
mkServarr = name: {
${name} = {
enable = true;
package = unstablePkgs.${name};
};
mkCaddy = name: {
caddy.virtualHosts."${name}.tsuba.darksailor.dev".extraConfig = ''
import hetzner
reverse_proxy localhost:${builtins.toString config.services.${name}.settings.server.port}
'';
};
in {
services =
mkServarr "radarr"
// mkServarr "sonarr"
// mkServarr "prowlarr";
# // mkServarr "readarr"
# // mkServarr "bazarr";
services = {
sonarr = {
enable = true;
package = unstablePkgs.sonarr;
group = "media";
};
radarr = {
enable = true;
package = unstablePkgs.radarr;
group = "media";
};
prowlarr = {
enable = true;
package = unstablePkgs.prowlarr;
};
caddy.virtualHosts = {
"sonarr.tsuba.darksailor.dev".extraConfig = ''
import hetzner
reverse_proxy localhost:${builtins.toString config.services.sonarr.settings.server.port}
'';
"radarr.tsuba.darksailor.dev".extraConfig = ''
import hetzner
reverse_proxy localhost:${builtins.toString config.services.radarr.settings.server.port}
'';
"prowlarr.tsuba.darksailor.dev".extraConfig = ''
import hetzner
reverse_proxy localhost:${builtins.toString config.services.prowlarr.settings.server.port}
'';
};
};
}

View File

@@ -27,11 +27,11 @@
# ];
# };
# };
hardware.raspberry-pi.extra-config = ''
[all]
dtparam=pciex1
dtparam=pciex1_gen=2
'';
# hardware.raspberry-pi.extra-config = ''
# [all]
# dtparam=pciex1
# dtparam=pciex1_gen=2
# '';
}
# ({
# config,