about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/kwalletcli/default.nix
blob: c1849bdca3953c30281cfc54015a76249c562329 (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
{ mkDerivation, fetchFromGitHub, lib, makeWrapper, pkg-config
, kcoreaddons, ki18n, kwallet, mksh, pinentry-qt }:

mkDerivation rec {
  pname = "kwalletcli";
  version = "3.02";

  src = fetchFromGitHub {
    owner = "MirBSD";
    repo = pname;
    rev = "${pname}-${lib.replaceStrings [ "." ] [ "_" ] version}";
    sha256 = "1gq45afb5nmmjfqxglv7wvcxcjd9822pc7nysq0350jmmmqwb474";
  };

  postPatch = ''
    substituteInPlace GNUmakefile \
      --replace -I/usr/include/KF5/KCoreAddons -I${kcoreaddons.dev}/include/KF5/KCoreAddons \
      --replace -I/usr/include/KF5/KI18n       -I${ki18n.dev}/include/KF5/KI18n \
      --replace -I/usr/include/KF5/KWallet     -I${kwallet.dev}/include/KF5/KWallet \
      --replace /usr/bin                       $out/bin \
      --replace /usr/share/man                 $out/share/man

    substituteInPlace pinentry-kwallet \
      --replace '/usr/bin/env mksh' ${mksh}/bin/mksh
  '';

  makeFlags = [ "KDE_VER=5" ];

  nativeBuildInputs = [ makeWrapper pkg-config ];
  # if using just kwallet, cmake will be added as a buildInput and fail the build
  propagatedBuildInputs = [ kcoreaddons ki18n (lib.getLib kwallet) ];

  preInstall = ''
    mkdir -p $out/bin $out/share/man/man1
  '';

  postInstall = ''
    wrapProgram $out/bin/pinentry-kwallet \
      --prefix PATH : $out/bin:${lib.makeBinPath [ pinentry-qt ]} \
      --set-default PINENTRY pinentry-qt
  '';

  meta = with lib; {
    description = "Command-Line Interface to the KDE Wallet";
    homepage = "https://www.mirbsd.org/kwalletcli.htm";
    license = licenses.miros;
    maintainers = with maintainers; [ peterhoeg ];
  };
}