blob: fdc99fcfaa0087785460097388feb9866600ae7d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
{ lib, fetchFromGitHub, python3Packages }:
python3Packages.buildPythonApplication rec {
pname = "trash-cli";
version = "0.23.2.13.2";
src = fetchFromGitHub {
owner = "andreafrancia";
repo = "trash-cli";
rev = version;
hash = "sha256-TJEi7HKIrfOdb+LLRt2DN5gWdFzUeo6isb59lFLK4bQ=";
};
propagatedBuildInputs = with python3Packages; [ psutil six ];
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,list,put,restore}}; do
$out/bin/$bin --print-completion bash > $bin
install -Dm644 $bin -t $out/share/bash-completion/completions
$out/bin/$bin --print-completion zsh > _$bin
install -Dm644 _$bin -t $out/share/zsh/site-functions
$out/bin/$bin --print-completion tcsh > $bin.csh
install -Dm644 $bin.csh -t $out/etc/profile.d
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";
};
}
|