nixpkgs/pkgs/tools/misc/trash-cli/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.8 KiB
Nix
Raw Normal View History

{ lib, fetchFromGitHub, installShellFiles, nix-update-script, python3Packages }:
2017-03-03 01:44:17 +00:00
python3Packages.buildPythonApplication rec {
2020-03-29 10:34:50 +00:00
pname = "trash-cli";
version = "0.24.5.26";
2014-12-23 07:35:26 +00:00
2017-03-03 01:44:17 +00:00
src = fetchFromGitHub {
owner = "andreafrancia";
repo = "trash-cli";
2019-09-08 23:38:31 +00:00
rev = version;
hash = "sha256-ltuMnxtG4jTTSZd6ZHWl8wI0oQMMFqW0HAPetZMfGtc=";
2014-12-23 07:35:26 +00:00
};
2022-10-24 08:54:22 +00:00
propagatedBuildInputs = with python3Packages; [ psutil six ];
2014-12-23 07:35:26 +00:00
2023-04-03 20:15:12 +00:00
nativeBuildInputs = with python3Packages; [
installShellFiles
shtab
];
nativeCheckInputs = with python3Packages; [
mock
pytestCheckHook
];
2021-04-29 19:58:42 +00:00
2023-03-23 15:35:23 +00:00
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
'';
2023-03-30 08:34:55 +00:00
postInstall = ''
2023-04-03 20:15:12 +00:00
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)
2023-03-30 08:34:55 +00:00
done
'';
2014-12-23 07:35:26 +00:00
passthru.updateScript = nix-update-script { };
meta = with lib; {
homepage = "https://github.com/andreafrancia/trash-cli";
2023-03-23 15:35:23 +00:00
description = "Command line interface to the freedesktop.org trashcan";
maintainers = [ maintainers.rycee ];
2018-06-11 10:26:52 +00:00
platforms = platforms.unix;
license = licenses.gpl2Plus;
2021-04-27 17:46:48 +00:00
mainProgram = "trash";
2014-12-23 07:35:26 +00:00
};
}