1 { lib, fetchFromGitHub, installShellFiles, nix-update-script, python3Packages }:
3 python3Packages.buildPythonApplication rec {
7 src = fetchFromGitHub {
8 owner = "andreafrancia";
11 hash = "sha256-ltuMnxtG4jTTSZd6ZHWl8wI0oQMMFqW0HAPetZMfGtc=";
14 propagatedBuildInputs = with python3Packages; [ psutil six ];
16 nativeBuildInputs = with python3Packages; [
21 nativeCheckInputs = with python3Packages; [
27 sed -i '/typing/d' setup.cfg
30 doInstallCheck = true;
31 installCheckPhase = ''
32 runHook preInstallCheck
34 # Create a home directory with a test file.
36 touch "$HOME/deleteme"
38 # Verify that trash list is initially empty.
39 [[ $($out/bin/trash-list) == "" ]]
41 # Trash a test file and verify that it shows up in the list.
42 $out/bin/trash "$HOME/deleteme"
43 [[ $($out/bin/trash-list) == *" $HOME/deleteme" ]]
45 # Empty the trash and verify that it is empty.
47 [[ $($out/bin/trash-list) == "" ]]
49 runHook postInstallCheck
52 for bin in trash-empty trash-list trash-restore trash-put trash; do
53 installShellCompletion --cmd "$bin" \
54 --bash <("$out/bin/$bin" --print-completion bash) \
55 --zsh <("$out/bin/$bin" --print-completion zsh)
59 passthru.updateScript = nix-update-script { };
62 homepage = "https://github.com/andreafrancia/trash-cli";
63 description = "Command line interface to the freedesktop.org trashcan";
64 maintainers = [ maintainers.rycee ];
65 platforms = platforms.unix;
66 license = licenses.gpl2Plus;
67 mainProgram = "trash";