main
1{
2 python3,
3 lib,
4 makeWrapper,
5 rsync,
6 openssh,
7}:
8
9python3.pkgs.buildPythonApplication {
10 pname = "jellyfin-favorites-sync";
11 version = "1.0.0";
12 format = "other";
13
14 src = ./.;
15
16 nativeBuildInputs = [ makeWrapper ];
17
18 propagatedBuildInputs = with python3.pkgs; [
19 requests
20 click
21 ];
22
23 installPhase = ''
24 runHook preInstall
25
26 mkdir -p $out/bin
27 cp jellyfin-favorites-sync $out/bin/
28 chmod +x $out/bin/jellyfin-favorites-sync
29
30 # Replace uv shebang with python3 for Nix packaging
31 substituteInPlace $out/bin/jellyfin-favorites-sync \
32 --replace-fail '#!/usr/bin/env -S uv run --script' '#!/usr/bin/env python3' \
33 --replace-fail '# /// script' '# (uv metadata removed for Nix packaging)' \
34 --replace-fail '# requires-python' '# (requires-python' \
35 --replace-fail '# dependencies' '# (dependencies' \
36 --replace-fail '# ///' '# )'
37
38 # Wrap to add arr lib to PYTHONPATH and rsync/ssh to PATH
39 wrapProgram $out/bin/jellyfin-favorites-sync \
40 --prefix PYTHONPATH : "${../arr}" \
41 --prefix PATH : "${
42 lib.makeBinPath [
43 rsync
44 openssh
45 ]
46 }"
47
48 runHook postInstall
49 '';
50
51 meta = {
52 description = "Sync Jellyfin favorite items to remote host via rsync";
53 license = lib.licenses.mit;
54 platforms = lib.platforms.unix;
55 mainProgram = "jellyfin-favorites-sync";
56 };
57}