1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 autoreconfHook,
6 pam,
7 qrencode,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "google-authenticator-libpam";
12 version = "1.11";
13
14 src = fetchFromGitHub {
15 owner = "google";
16 repo = "google-authenticator-libpam";
17 rev = version;
18 hash = "sha256-cLMX5SdKvyQr3annc/Hhhz6XgY+BypRHASKRh6xTdmo=";
19 };
20
21 nativeBuildInputs = [ autoreconfHook ];
22 buildInputs = [ pam ];
23
24 preConfigure = ''
25 sed -i "s|libqrencode.so.4|${qrencode.out}/lib/libqrencode.so.4|" src/google-authenticator.c
26 '';
27
28 installPhase = ''
29 mkdir -p $out/bin $out/lib/security
30 cp ./.libs/pam_google_authenticator.so $out/lib/security
31 cp google-authenticator $out/bin
32 '';
33
34 meta = with lib; {
35 homepage = "https://github.com/google/google-authenticator-libpam";
36 description = "Two-step verification, with pam module";
37 mainProgram = "google-authenticator";
38 license = licenses.asl20;
39 maintainers = with maintainers; [ aneeshusa ];
40 platforms = platforms.linux;
41 };
42}