nftable-migration
 1{
 2  python3,
 3  lib,
 4  makeWrapper,
 5}:
 6
 7python3.pkgs.buildPythonApplication {
 8  pname = "arr";
 9  version = "1.1.0";
10  format = "other";
11
12  src = ./.;
13
14  nativeBuildInputs = [ makeWrapper ];
15
16  propagatedBuildInputs = with python3.pkgs; [
17    click
18    requests
19    spotipy
20  ];
21
22  # Don't try to create __pycache__ directories during build
23  dontUsePythonImportsCheck = true;
24
25  installPhase = ''
26    mkdir -p $out/bin $out/lib/arr
27
28    # Install the main CLI
29    cp arr $out/bin/arr
30    chmod +x $out/bin/arr
31
32    # Install the library
33    cp lib.py $out/lib/arr/
34
35    # Install commands
36    cp -r commands $out/lib/arr/
37
38    # Create __init__.py for the package
39    touch $out/lib/arr/__init__.py
40
41    # Wrap the main script to set PYTHONPATH
42    wrapProgram $out/bin/arr \
43      --prefix PYTHONPATH : "$out/lib/arr"
44  '';
45
46  meta = with lib; {
47    description = "Unified CLI for managing *arr services (Sonarr, Radarr, Lidarr)";
48    longDescription = ''
49      arr provides a consistent interface for common operations across
50      the *arr media management stack, including renaming, retagging,
51      path updates, and Spotify playlist syncing.
52    '';
53    platforms = platforms.unix;
54  };
55}