From 7b87c7071f3402c9cbd7b4a712646f6403826ea0 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Fri, 13 Jun 2025 21:46:40 +0530 Subject: [PATCH] feat: Added jellyfin for shiro --- darwin/shiro/services/jellyfin.nix | 22 ++++++------- home/scripts.nix | 10 +++++- modules/macos/jellyfin.nix | 51 +++++++++++++++--------------- scripts/yt-dlp.sh | 2 +- 4 files changed, 47 insertions(+), 38 deletions(-) diff --git a/darwin/shiro/services/jellyfin.nix b/darwin/shiro/services/jellyfin.nix index cdccab67..06d34929 100644 --- a/darwin/shiro/services/jellyfin.nix +++ b/darwin/shiro/services/jellyfin.nix @@ -1,13 +1,13 @@ {...}: { - # imports = [../../../modules/jellyfin.nix]; - # services = { - # jellyfin = { - # enable = false; - # }; - # # caddy = { - # # virtualHosts."media.darksailor.dev".extraConfig = '' - # # reverse_proxy localhost:8096 - # # ''; - # # }; - # }; + imports = [../../../modules/macos/jellyfin.nix]; + services = { + jellyfin = { + enable = true; + }; + # caddy = { + # virtualHosts."media.darksailor.dev".extraConfig = '' + # reverse_proxy localhost:8096 + # ''; + # }; + }; } diff --git a/home/scripts.nix b/home/scripts.nix index 12230e9b..1c30a113 100644 --- a/home/scripts.nix +++ b/home/scripts.nix @@ -1,4 +1,10 @@ -{pkgs, ...}: { +{pkgs, ...}: let + mkScript = scriptFile: deps: (pkgs.writeShellApplication { + runtimeInputs = deps; + name = builtins.baseNameOf scriptFile; + text = builtins.readFile scriptFile; + }); +in { home.packages = [ (pkgs.writeShellApplication { @@ -26,5 +32,7 @@ exec $EDITOR "$1" ''; }) + (mkScript ../scripts/yt-dlp.sh (with pkgs; [yt-dlp])) + (mkScript ../scripts/autossh.sh (with pkgs; [autossh openssh])) ]; } diff --git a/modules/macos/jellyfin.nix b/modules/macos/jellyfin.nix index ad483f17..c78c238a 100644 --- a/modules/macos/jellyfin.nix +++ b/modules/macos/jellyfin.nix @@ -37,39 +37,40 @@ in { }; config = mkIf cfg.enable { - users.users.jellyfin = { - name = "jellyfin"; - uid = mkDefault 601; - gid = mkDefault config.users.groups.jellyfin.gid; - home = cfg.dataDir; - createHome = true; - shell = "/bin/bash"; - description = "Jellyfin runner user account"; - }; - users.groups.jellyfin = { - name = "jellyfin"; - gid = mkDefault 602; - description = "Jellyfin runner group"; - }; + # users.users.jellyfin = { + # name = "jellyfin"; + # uid = mkDefault 601; + # gid = mkDefault config.users.groups.jellyfin.gid; + # home = cfg.dataDir; + # createHome = true; + # shell = "/bin/bash"; + # description = "Jellyfin runner user account"; + # }; + # users.groups.jellyfin = { + # name = "jellyfin"; + # gid = mkDefault 602; + # description = "Jellyfin runner group"; + # }; environment.systemPackages = [cfg.package]; launchd.daemons.jellyfin = { - environment = { - HOME = cfg.dataDir; - }; + # environment = { + # HOME = cfg.dataDir; + # }; path = [cfg.package pkgs.coreutils pkgs.darwin.DarwinTools]; command = "${lib.getExe cfg.package}"; serviceConfig = { + UserName = "servius"; # ProcessType = "Background"; - Label = "org.jellyfin.server"; - RunAtLoad = true; - # KeepAlive = true; - UserName = "${config.users.users.jellyfin.name}"; - GroupName = "${config.users.groups.jellyfin.name}"; - StandardOutPath = "${cfg.dataDir}/log/jellyfin.log"; - StandardErrorPath = "${cfg.dataDir}/log/jellyfin.error.log"; - WorkingDirectory = cfg.dataDir; + # Label = "org.jellyfin.server"; + # RunAtLoad = true; + KeepAlive = true; + # UserName = "${config.users.users.jellyfin.name}"; + # GroupName = "${config.users.groups.jellyfin.name}"; + # StandardOutPath = "${cfg.dataDir}/log/jellyfin.log"; + # StandardErrorPath = "${cfg.dataDir}/log/jellyfin.error.log"; + # WorkingDirectory = cfg.dataDir; }; }; }; diff --git a/scripts/yt-dlp.sh b/scripts/yt-dlp.sh index cf68ce29..3c9a8f1f 100755 --- a/scripts/yt-dlp.sh +++ b/scripts/yt-dlp.sh @@ -1,2 +1,2 @@ #!/bin/bash -yt-dlp --proxy socks5://127.0.0.1:1080 $@ +yt-dlp --proxy socks5://127.0.0.1:1080 "$@"