504525a148
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
67 lines
1.7 KiB
Nix
67 lines
1.7 KiB
Nix
{ lib, fetchFromGitHub, installShellFiles, python3Packages }:
|
|
|
|
python3Packages.buildPythonApplication rec {
|
|
pname = "trash-cli";
|
|
version = "0.23.11.10";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "andreafrancia";
|
|
repo = "trash-cli";
|
|
rev = version;
|
|
hash = "sha256-bP1x+yYAsPQ1vXS3rmHD11UiJ7r/02akb84hr+o8JLs=";
|
|
};
|
|
|
|
propagatedBuildInputs = with python3Packages; [ psutil six ];
|
|
|
|
nativeBuildInputs = with python3Packages; [
|
|
installShellFiles
|
|
shtab
|
|
];
|
|
|
|
nativeCheckInputs = with python3Packages; [
|
|
mock
|
|
pytestCheckHook
|
|
];
|
|
|
|
postPatch = ''
|
|
sed -i '/typing/d' setup.cfg
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
installCheckPhase = ''
|
|
runHook preInstallCheck
|
|
|
|
# Create a home directory with a test file.
|
|
HOME="$(mktemp -d)"
|
|
touch "$HOME/deleteme"
|
|
|
|
# Verify that trash list is initially empty.
|
|
[[ $($out/bin/trash-list) == "" ]]
|
|
|
|
# Trash a test file and verify that it shows up in the list.
|
|
$out/bin/trash "$HOME/deleteme"
|
|
[[ $($out/bin/trash-list) == *" $HOME/deleteme" ]]
|
|
|
|
# Empty the trash and verify that it is empty.
|
|
$out/bin/trash-empty
|
|
[[ $($out/bin/trash-list) == "" ]]
|
|
|
|
runHook postInstallCheck
|
|
'';
|
|
postInstall = ''
|
|
for bin in trash-empty trash-list trash-restore trash-put trash; do
|
|
installShellCompletion --cmd "$bin" \
|
|
--bash <("$out/bin/$bin" --print-completion bash) \
|
|
--zsh <("$out/bin/$bin" --print-completion zsh)
|
|
done
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/andreafrancia/trash-cli";
|
|
description = "Command line interface to the freedesktop.org trashcan";
|
|
maintainers = [ maintainers.rycee ];
|
|
platforms = platforms.unix;
|
|
license = licenses.gpl2Plus;
|
|
mainProgram = "trash";
|
|
};
|
|
}
|