1let version = "2.10.0"; in
2{ stdenv, lib, buildPackages, fetchurl, zlib, gettext, fetchpatch2
3, lists ? [ (fetchurl {
4 url = "https://github.com/cracklib/cracklib/releases/download/v${version}/cracklib-words-${version}.gz";
5 hash = "sha256-JDLo/bSLIijC2DUl+8Q704i2zgw5cxL6t68wvuivPpY=";
6}) ]
7}:
8
9stdenv.mkDerivation rec {
10 pname = "cracklib";
11 inherit version;
12
13 src = fetchurl {
14 url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${pname}-${version}.tar.bz2";
15 hash = "sha256-cAw5YMplCx6vAhfWmskZuBHyB1o4dGd7hMceOG3V51Y=";
16 };
17
18 patches = lib.optionals stdenv.isDarwin [
19 # Fixes build failure on Darwin due to missing byte order functions.
20 # https://github.com/cracklib/cracklib/pull/96
21 (fetchpatch2 {
22 url = "https://github.com/cracklib/cracklib/commit/dff319e543272c1fb958261cf9ee8bb82960bc40.patch";
23 hash = "sha256-QaWpEVV6l1kl4OIkJAqkXPVThbo040Rv9X2dY/+syqs=";
24 stripLen = 1;
25 })
26 ];
27
28 nativeBuildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.cracklib;
29 buildInputs = [ zlib gettext ];
30
31 postPatch = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
32 chmod +x util/cracklib-format
33 patchShebangs util
34
35 '' + ''
36 ln -vs ${toString lists} dicts/
37 '';
38
39 postInstall = ''
40 make dict-local
41 '';
42 doInstallCheck = true;
43 installCheckTarget = "test";
44
45 meta = with lib; {
46 homepage = "https://github.com/cracklib/cracklib";
47 description = "Library for checking the strength of passwords";
48 license = licenses.lgpl21; # Different license for the wordlist: http://www.openwall.com/wordlists
49 maintainers = with maintainers; [ lovek323 ];
50 platforms = platforms.unix;
51 };
52}