<commit_before>{ stdenv, fetchFromGitHub
, autoreconfHook, pkgconfig
, gtk3, nssTools, pcsclite
, libxml2, libproxy 
, openssl, curl
, makeWrapper }:

stdenv.mkDerivation rec {
  name = "eid-mw-${version}";
  version = "4.4.9";

  src = fetchFromGitHub {
    sha256 = "019cfxgffl6z6ilz1w6b531dr8pi63ikflxmkc95glh7cxsaylax"; 
    rev = "v${version}";
    repo = "eid-mw";
    owner = "Fedict";
  };

  nativeBuildInputs = [ autoreconfHook pkgconfig makeWrapper ];
  buildInputs = [ gtk3 pcsclite libxml2 libproxy curl openssl ];
  preConfigure = ''
    mkdir openssl
    ln -s ${openssl.out}/lib openssl
    ln -s ${openssl.bin}/bin openssl
    ln -s ${openssl.dev}/include openssl
    export SSL_PREFIX=$(realpath openssl)
    '';

  postPatch = ''
    sed 's@m4_esyscmd_s(.*,@[${version}],@' -i configure.ac
  '';

  configureFlags = [ "--enable-dialogs=yes" ];

  postInstall = ''
    install -D ${./eid-nssdb.in} $out/bin/eid-nssdb
    substituteInPlace $out/bin/eid-nssdb \<commit_msg>eid-mw: 4.4.9 -> 4.4.11<commit_after>{ stdenv, fetchFromGitHub
, autoreconfHook, pkgconfig
, gtk3, nssTools, pcsclite
, libxml2, libproxy 
, openssl, curl
, makeWrapper }:

stdenv.mkDerivation rec {
  name = "eid-mw-${version}";
  version = "4.4.11";

  src = fetchFromGitHub {
    sha256 = "13mhz23j2gp5bywdq2xiwkk0gnc354j31ry8x35pzlwrcn19by10"; 
    rev = "v${version}";
    repo = "eid-mw";
    owner = "Fedict";
  };

  nativeBuildInputs = [ autoreconfHook pkgconfig makeWrapper ];
  buildInputs = [ gtk3 pcsclite libxml2 libproxy curl openssl ];
  preConfigure = ''
    mkdir openssl
    ln -s ${openssl.out}/lib openssl
    ln -s ${openssl.bin}/bin openssl
    ln -s ${openssl.dev}/include openssl
    export SSL_PREFIX=$(realpath openssl)
    '';

  postPatch = ''
    sed 's@m4_esyscmd_s(.*,@[${version}],@' -i configure.ac
  '';

  configureFlags = [ "--enable-dialogs=yes" ];

  postInstall = ''
    install -D ${./eid-nssdb.in} $out/bin/eid-nssdb
    substituteInPlace $out/bin/eid-nssdb \
{'fraction_non_alphanumeric': 0.1518350930115636, 'fraction_numerical': 0.033182503770739065, 'mean_word_length': 3.422222222222222, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '2257085', 'n_tokens_mistral': 853, 'n_tokens_neox': 789, 'n_words': 146}