1{ stdenv, fetchzip, autoconf, automake, openssl, libxml2, fetchFromGitHub, ncurses }:
2
3let
4 scrypt_src = fetchzip {
5 url = "http://www.tarsnap.com/scrypt/scrypt-1.2.0.tgz";
6 sha256 = "0ahylib2pimlhjcm566kpim6n16jci5v749xwdkr9ivgfjrv3xn4";
7 };
8
9in stdenv.mkDerivation {
10 name = "mpw-2.1-6834f36";
11
12 src = fetchFromGitHub {
13 owner = "Lyndir";
14 repo = "MasterPassword";
15 rev = "6834f3689f5dfd4e59ad6959961d349c224977ee";
16 sha256 = "0zlpx3hb1y2l60hg961h05lb9yf3xb5phnyycvazah2674gkwb2p";
17 };
18
19 postUnpack = ''
20 sourceRoot+=/MasterPassword/C
21 '';
22
23 prePatch = ''
24 patchShebangs .
25 mkdir lib/scrypt/src
26 cp -R --no-preserve=ownership ${scrypt_src}/* lib/scrypt/src
27 chmod +w -R lib/scrypt/src
28 substituteInPlace lib/scrypt/src/libcperciva/cpusupport/Build/cpusupport.sh \
29 --replace dirname "$(type -P dirname)"
30 substituteInPlace lib/scrypt/src/Makefile.in --replace "command -p mv" "mv"
31 '';
32
33 NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";
34
35 buildInputs = [ autoconf automake openssl libxml2 ncurses ];
36
37 buildPhase = ''
38 substituteInPlace build --replace '"curses"' '"ncurses"'
39 targets="mpw mpw-tests" ./build
40 '';
41
42 installPhase = ''
43 mkdir -p $out/bin
44 mv mpw $out/bin/mpw
45 '';
46
47 meta = {
48 platforms = stdenv.lib.platforms.unix;
49 };
50}