<commit_before>{ stdenv, fetchurl, autoconf, automake, openssl, libxml2 }:

let
  scrypt_src = fetchurl {
    url = "http://masterpasswordapp.com/libscrypt-b12b554.tar.gz";
    sha256 = "02vz4i66v1acd15xjgki4ilmmp28m6a5603gi4hf8id3d3ndl9n7";
  };

in stdenv.mkDerivation {
  name = "mpw-2.1-cli4";

  srcs = [
    (fetchurl {
      url = "https://ssl.masterpasswordapp.com/mpw-2.1-cli4-0-gf6b2287.tar.gz";
      sha256 = "141bzb3nj18rbnbpdvsri8cdwwwxz4d6akyhfa834542xf96b9vf";
    })
    scrypt_src
  ];

  sourceRoot = ".";

  postUnpack = ''
    cp -R libscrypt-b12b554/* lib/scrypt
  '';

  prePatch = ''
    patchShebangs .
  '';

  NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";

  buildInputs = [ autoconf automake openssl libxml2 ];

  buildPhase = ''
    targets="mpw mpw-tests" ./build
  '';

  installPhase = ''
    mkdir -p $out/bin
    mv mpw $out/bin/mpw
  '';

  meta = {
    platforms = stdenv.lib.platforms.unix;
  };
}
<commit_msg>mpw: build from github to fix segfault<commit_after>{ stdenv, fetchzip, autoconf, automake, openssl, libxml2, fetchFromGitHub, ncurses }:

let
  scrypt_src = fetchzip {
    url = "http://www.tarsnap.com/scrypt/scrypt-1.2.0.tgz";
    sha256 = "0ahylib2pimlhjcm566kpim6n16jci5v749xwdkr9ivgfjrv3xn4";
  };

in stdenv.mkDerivation {
  name = "mpw-2.1-6834f36";

  src = fetchFromGitHub {
    owner = "Lyndir";
    repo = "MasterPassword";
    rev = "6834f3689f5dfd4e59ad6959961d349c224977ee";
    sha256 = "0zlpx3hb1y2l60hg961h05lb9yf3xb5phnyycvazah2674gkwb2p";
  };

  postUnpack = ''
    sourceRoot+=/MasterPassword/C
  '';

  prePatch = ''
    patchShebangs .
    mkdir lib/scrypt/src
    cp -R --no-preserve=ownership ${scrypt_src}/* lib/scrypt/src
    chmod +w -R lib/scrypt/src
    substituteInPlace lib/scrypt/src/libcperciva/cpusupport/Build/cpusupport.sh \
      --replace dirname "$(type -P dirname)"
    substituteInPlace lib/scrypt/src/Makefile.in --replace "command -p mv" "mv"
  '';

  NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";

  buildInputs = [ autoconf automake openssl libxml2 ncurses ];

  buildPhase = ''
    substituteInPlace build --replace '"curses"' '"ncurses"'
    targets="mpw mpw-tests" ./build
  '';

  installPhase = ''
    mkdir -p $out/bin
    mv mpw $out/bin/mpw
  '';

  meta = {
    platforms = stdenv.lib.platforms.unix;
  };
}

{'fraction_non_alphanumeric': 0.14065180102915953, 'fraction_numerical': 0.06646655231560893, 'mean_word_length': 3.2036036036036037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5306740', 'n_tokens_mistral': 1072, 'n_tokens_neox': 991, 'n_words': 146}