aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/security/pass/extensions/import.nix
blob: 885dd05110f32cd4116af1833cae1d7202cc7543 (plain)
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
{ stdenv, pass, fetchFromGitHub, pythonPackages, makeWrapper, fetchpatch }:

let
  pythonEnv = pythonPackages.python.withPackages (p: [
    p.defusedxml
    p.setuptools
    p.pyaml
    p.pykeepass
    p.filemagic
    p.cryptography
    p.secretstorage
  ]);

in stdenv.mkDerivation rec {
  pname = "pass-import";
  version = "3.1";

  src = fetchFromGitHub {
    owner = "roddhjav";
    repo = "pass-import";
    rev = "v${version}";
    sha256 = "sha256-nH2xAqWfMT+Brv3z9Aw6nbvYqArEZjpM28rKsRPihqA=";
  };

  patches = [ ./0001-Fix-installation-with-Nix.patch ];

  nativeBuildInputs = [ makeWrapper ];

  buildInputs = [ pythonEnv ];

  makeFlags = [ "DESTDIR=${placeholder "out"}" ];

  postInstall = ''
    wrapProgram $out/bin/pimport \
      --prefix PATH : "${pythonEnv}/bin" \
      --prefix PYTHONPATH : "$out/${pythonPackages.python.sitePackages}"
    wrapProgram $out/lib/password-store/extensions/import.bash \
      --prefix PATH : "${pythonEnv}/bin" \
      --prefix PYTHONPATH : "$out/${pythonPackages.python.sitePackages}"
  '';

  meta = with stdenv.lib; {
    description = "Pass extension for importing data from existing password managers";
    homepage = "https://github.com/roddhjav/pass-import";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ lovek323 fpletz tadfisher ];
    platforms = platforms.unix;
  };
}