diff --git a/flake.lock b/flake.lock index f8c24ce..9713390 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1715486357, - "narHash": "sha256-4pRuzsHZOW5W4CsXI9uhKtiJeQSUoe1d2M9mWU98HC4=", + "lastModified": 1715930644, + "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", "owner": "nix-community", "repo": "home-manager", - "rev": "44677a1c96810a8e8c4ffaeaad10c842402647c1", + "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1715148395, - "narHash": "sha256-lRxjTxY3103LGMjWdVqntKZHhlmMX12QUjeFrQMmGaE=", + "lastModified": 1716173274, + "narHash": "sha256-FC21Bn4m6ctajMjiUof30awPBH/7WjD0M5yqrWepZbY=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "a4e2b7909fc1bdf30c30ef21d388fde0b5cdde4a", + "rev": "d9e0b26202fd500cf3e79f73653cce7f7d541191", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1715787315, - "narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=", + "lastModified": 1716137900, + "narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5", + "rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1", "type": "github" }, "original": { diff --git a/overlays/isisdl.nix b/overlays/isisdl.nix index 07658f8..183340c 100644 --- a/overlays/isisdl.nix +++ b/overlays/isisdl.nix @@ -1,93 +1,30 @@ -{ lib +{ pkgs +, lib , buildPythonApplication , fetchPypi -, cryptography -, requests -, pyyaml -, packaging -, colorama -, pyinotify -, distro -, psutil +, python3Packages +, withFFmpeg ? false }: -let - remove-completion-patch = builtins.toFile "remove-completion-patch" '' - diff --git a/src/isisdl/utils.py b/src/isisdl/utils.py - index 691e18f..8597bf0 100644 - --- a/src/isisdl/utils.py - +++ b/src/isisdl/utils.py - @@ -399,55 +399,6 @@ def startup() -> None: - with open(config_file_location, "w") as f: - f.write(f"# You probably want to start by copying {example_config_file_location} and adapting it.\n") - - - if not is_windows and not is_static: - - # Install completions if they don't exist already - - user_dir = os.path.expanduser("~") - - - - if shutil.which("zsh") is not None: - - default_path = f"{user_dir}/.local/share/zsh/site-functions" - - whitelist_paths = [ - - f"{user_dir}/.oh-my-zsh/completions", - - f"{user_dir}/.oh-my-zsh/custom/plugins/zsh-completions/src", - - ] - - - - # Since the session is interactive it might contain stuff like neofetch etc. - - rand_string = "".join(random.choice(string.ascii_letters) for _ in range(32)) - - fpath = subprocess.check_output(["zsh", "-c", "-i", f"echo {rand_string}; echo $FPATH"]) \ - - .decode().split(rand_string)[-1].strip().split(":") - - - - # 1. Find install path (default .local/share/zsh/site-functions or .local/share/isisdl/) - - # 2. copy _isisdl there - - - - # 3. Export this path to $FPATH via .zshrc (make this transparent to user) - - # 4. autoload [path]/_isisdl - - - - for final_path in whitelist_paths: - - for p in fpath: - - if final_path == p and not (os.path.exists(final_path) and not os.access(final_path, os.W_OK | os.X_OK)): - - break - - - - else: - - final_path = default_path - - - - # Here the file is always copied to the destination dir. - - # This is fine since the Filesystem will (hopefully) realize that the files are the same and thus ignore it. - - os.makedirs(final_path, exist_ok=True) - - - - completion_source = source_code_location.joinpath("resources", "completions", "zsh", "_isisdl") - - if completion_source.exists(): - - shutil.copy(completion_source, final_path) - - - - # TODO: Also tag this file as autoloadable - - - - if shutil.which("fish") is not None: - - # TODO - - pass - - - - if shutil.which("bash") is not None: - - final_path = f"{user_dir}/.local/share/bash-completion/completions" - - os.makedirs(final_path, exist_ok=True) - - shutil.copy(source_code_location.joinpath("resources", "completions", "zsh", "_isisdl"), final_path) - - - - def clear() -> None: - if is_windows: - ''; -in buildPythonApplication rec { pname = "isisdl"; - version = "1.3.19"; + version = "1.3.20"; src = fetchPypi { inherit pname version; - hash = "sha256-VcqaFqcoH+d1NpKq7QBVbXcbe0HfZ67kStGFiYmr/kE="; + hash = "sha256-s0vGCJVSa6hf6/sIhzmaxpziP4izoRwcZfxvm//5inY="; }; - patches = [ - remove-completion-patch + pyproject = true; + + build-system = with python3Packages; [ + setuptools ]; - propagatedBuildInputs = [ + nativeBuildInputs = with python3Packages; [ + pythonRelaxDepsHook + ]; + + dependencies = with python3Packages; [ cryptography requests pyyaml @@ -98,11 +35,32 @@ buildPythonApplication rec { psutil ]; + pythonRelaxDeps = [ + "cryptography" + "requests" + "packaging" + "distro" + ]; + + buildInputs = [ + pkgs.util-linux # for runtime dependency `lsblk` + ] ++ lib.optionals withFFmpeg [ + pkgs.ffmpeg + ]; + + # disable tests since they require valid login credentials doCheck = false; meta = with lib; { homepage = "https://github.com/Emily3403/isisdl"; description = "A downloader for ISIS of TU-Berlin"; - license = licenses.mit; + longDescription = '' + A downloading utility for ISIS of TU-Berlin. + Download all your files and videos from ISIS. + ''; + license = licenses.gpl3; + maintainers = with maintainers; [ bchmnn ]; + mainProgram = "isisdl"; + platforms = platforms.linux; }; }