1{
2 mkDerivation,
3 fetchFromGitHub,
4 lib,
5 makeWrapper,
6 pkg-config,
7 kcoreaddons,
8 ki18n,
9 kwallet,
10 mksh,
11 pinentry-qt,
12}:
13
14mkDerivation rec {
15 pname = "kwalletcli";
16 version = "3.03";
17
18 src = fetchFromGitHub {
19 owner = "MirBSD";
20 repo = pname;
21 rev = "${pname}-${lib.replaceStrings [ "." ] [ "_" ] version}";
22 sha256 = "sha256-DUtaQITzHhQrqA9QJd0U/5EDjH0IzY9/kal/7SYQ/Ck=";
23 };
24
25 postPatch = ''
26 substituteInPlace GNUmakefile \
27 --replace -I/usr/include/KF5/KCoreAddons -I${kcoreaddons.dev}/include/KF5/KCoreAddons \
28 --replace -I/usr/include/KF5/KI18n -I${ki18n.dev}/include/KF5/KI18n \
29 --replace -I/usr/include/KF5/KWallet -I${kwallet.dev}/include/KF5/KWallet \
30 --replace /usr/bin $out/bin \
31 --replace /usr/share/man $out/share/man
32
33 substituteInPlace pinentry-kwallet \
34 --replace '/usr/bin/env mksh' ${mksh}/bin/mksh
35
36 substituteInPlace kwalletcli_getpin \
37 --replace '/usr/bin/env mksh' ${mksh}/bin/mksh
38 '';
39
40 makeFlags = [ "KDE_VER=5" ];
41
42 nativeBuildInputs = [
43 makeWrapper
44 pkg-config
45 ];
46 # if using just kwallet, cmake will be added as a buildInput and fail the build
47 propagatedBuildInputs = [
48 kcoreaddons
49 ki18n
50 (lib.getLib kwallet)
51 ];
52
53 preInstall = ''
54 mkdir -p $out/bin $out/share/man/man1
55 '';
56
57 postInstall = ''
58 for program in pinentry-kwallet kwalletcli_getpin; do
59 wrapProgram $out/bin/$program \
60 --prefix PATH : $out/bin:${lib.makeBinPath [ pinentry-qt ]} \
61 --set-default PINENTRY pinentry-qt
62 done
63 '';
64
65 meta = with lib; {
66 description = "Command-Line Interface to the KDE Wallet";
67 homepage = "https://www.mirbsd.org/kwalletcli.htm";
68 license = licenses.miros;
69 maintainers = with maintainers; [ peterhoeg ];
70 };
71}