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