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