Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 fetchFromGitHub, 4 installShellFiles, 5 nix-update-script, 6 python3Packages, 7}: 8 9python3Packages.buildPythonApplication rec { 10 pname = "trash-cli"; 11 version = "0.24.5.26"; 12 pyproject = true; 13 14 src = fetchFromGitHub { 15 owner = "andreafrancia"; 16 repo = "trash-cli"; 17 rev = version; 18 hash = "sha256-ltuMnxtG4jTTSZd6ZHWl8wI0oQMMFqW0HAPetZMfGtc="; 19 }; 20 21 nativeBuildInputs = [ 22 installShellFiles 23 ]; 24 25 build-system = with python3Packages; [ 26 setuptools 27 shtab # for shell completions 28 ]; 29 30 dependencies = with python3Packages; [ 31 psutil 32 six 33 ]; 34 35 nativeCheckInputs = with python3Packages; [ 36 mock 37 pytestCheckHook 38 ]; 39 40 postPatch = '' 41 sed -i '/typing/d' setup.cfg 42 ''; 43 44 doInstallCheck = true; 45 installCheckPhase = '' 46 runHook preInstallCheck 47 48 # Create a home directory with a test file. 49 HOME="$(mktemp -d)" 50 touch "$HOME/deleteme" 51 52 # Verify that trash list is initially empty. 53 [[ $($out/bin/trash-list) == "" ]] 54 55 # Trash a test file and verify that it shows up in the list. 56 $out/bin/trash "$HOME/deleteme" 57 [[ $($out/bin/trash-list) == *" $HOME/deleteme" ]] 58 59 # Empty the trash and verify that it is empty. 60 $out/bin/trash-empty 61 [[ $($out/bin/trash-list) == "" ]] 62 63 runHook postInstallCheck 64 ''; 65 66 pythonImportsCheck = [ "trashcli" ]; 67 68 postInstall = '' 69 for bin in trash-empty trash-list trash-restore trash-put trash; do 70 installShellCompletion --cmd "$bin" \ 71 --bash <("$out/bin/$bin" --print-completion bash) \ 72 --zsh <("$out/bin/$bin" --print-completion zsh) 73 done 74 ''; 75 76 passthru.updateScript = nix-update-script { }; 77 78 meta = with lib; { 79 homepage = "https://github.com/andreafrancia/trash-cli"; 80 description = "Command line interface to the freedesktop.org trashcan"; 81 maintainers = [ maintainers.rycee ]; 82 platforms = platforms.unix; 83 license = licenses.gpl2Plus; 84 mainProgram = "trash"; 85 }; 86}