feat(shiro): jellyfin broke

This commit is contained in:
uttarayan21
2025-02-13 00:16:28 +05:30
parent 8021a47841
commit ab2a805b9d
6 changed files with 53 additions and 51 deletions

View File

@@ -14,11 +14,11 @@
trusted-users = ["root" "servius"]; trusted-users = ["root" "servius"];
substituters = [ substituters = [
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
"https://sh.darksailor.dev" # "https://sh.darksailor.dev"
]; ];
trusted-public-keys = [ trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"mirai:bcVPoFGBZ0i7JAKMXIqLj2GY3CulLC4kP7rQyqes1RM=" # "mirai:bcVPoFGBZ0i7JAKMXIqLj2GY3CulLC4kP7rQyqes1RM="
]; ];
}; };
extraOptions = '' extraOptions = ''
@@ -28,8 +28,8 @@
''; '';
package = pkgs.nixVersions.latest; package = pkgs.nixVersions.latest;
buildMachines = [ buildMachines = [
../../builders/mirai.nix # ../../builders/mirai.nix
../../builders/shiro.nix # ../../builders/shiro.nix
]; ];
distributedBuilds = true; distributedBuilds = true;
}; };

View File

@@ -3,7 +3,6 @@
services = { services = {
jellyfin = { jellyfin = {
enable = false; enable = false;
# openFirewall = true;
}; };
# caddy = { # caddy = {
# virtualHosts."media.darksailor.dev".extraConfig = '' # virtualHosts."media.darksailor.dev".extraConfig = ''

View File

@@ -207,6 +207,7 @@
name = "shiro"; name = "shiro";
system = "aarch64-darwin"; system = "aarch64-darwin";
user = "servius"; user = "servius";
isServer = true;
} }
{ {
name = "SteamDeck"; name = "SteamDeck";

View File

@@ -39,7 +39,7 @@
}; };
serverAliveInterval = 120; serverAliveInterval = 120;
extraConfig = extraConfig =
lib.strings.optionalString pkgs.stdenv.isDarwin lib.strings.optionalString (pkgs.stdenv.isDarwin && !device.isServer)
'' ''
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
'' ''

View File

@@ -95,7 +95,7 @@
}; };
}; };
}; };
# enableFishIntegration = true; enableFishIntegration = false;
}; };
xdg.configFile."zellij/layouts/default.kdl" = { xdg.configFile."zellij/layouts/default.kdl" = {
text = text =

View File

@@ -1,11 +1,12 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.jellyfin;
in
{ {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.jellyfin;
in {
options.services.jellyfin = { options.services.jellyfin = {
enable = mkEnableOption "Jellyfin Media Server"; enable = mkEnableOption "Jellyfin Media Server";
@@ -16,17 +17,17 @@ in
description = "The package to use for Jellyfin"; description = "The package to use for Jellyfin";
}; };
user = mkOption { # user = mkOption {
type = types.str; # type = types.str;
default = "jellyfin"; # default = "jellyfin";
description = "User account under which Jellyfin runs."; # description = "User account under which Jellyfin runs.";
}; # };
#
group = mkOption { # group = mkOption {
type = types.str; # type = types.str;
default = "jellyfin"; # default = "jellyfin";
description = "Group under which Jellyfin runs."; # description = "Group under which Jellyfin runs.";
}; # };
dataDir = mkOption { dataDir = mkOption {
type = types.path; type = types.path;
@@ -36,39 +37,40 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ]; users.users.jellyfin = {
name = "jellyfin";
launchd.daemons.jellyfin = { uid = mkDefault 601;
command = "${lib.getExe cfg.package} --datadir '${cfg.dataDir}'"; gid = mkDefault config.users.groups.jellyfin.gid;
serviceConfig = {
Label = "org.jellyfin.server";
RunAtLoad = true;
KeepAlive = true;
UserName = cfg.user;
GroupName = cfg.group;
WorkingDirectory = cfg.dataDir;
StandardOutPath = "/var/log/jellyfin.log";
StandardErrorPath = "/var/log/jellyfin.error.log";
};
};
users.users = mkIf (cfg.user == "jellyfin") {
jellyfin = {
isSystemUser = true;
group = cfg.group;
home = cfg.dataDir; home = cfg.dataDir;
createHome = true; createHome = true;
shell = "/bin/bash";
description = "Jellyfin runner user account";
}; };
users.groups.jellyfin = {
name = "jellyfin";
gid = mkDefault 602;
description = "Jellyfin runner group";
}; };
users.groups = mkIf (cfg.group == "jellyfin") { environment.systemPackages = [cfg.package];
jellyfin = {};
};
# Create necessary directories and set permissions launchd.daemons.jellyfin = {
system.activationScripts.preActivation.text = '' environment = {
mkdir -p ${cfg.dataDir} HOME = cfg.dataDir;
chown ${cfg.user}:${cfg.group} ${cfg.dataDir} };
''; path = [cfg.package pkgs.coreutils pkgs.darwin.DarwinTools];
command = "${lib.getExe cfg.package}";
serviceConfig = {
# 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;
};
};
}; };
} }