1let version = "2.9.8"; in
2{ stdenv, lib, buildPackages, fetchurl, zlib, gettext
3, wordlists ? [ (fetchurl {
4 url = "https://github.com/cracklib/cracklib/releases/download/v${version}/cracklib-words-${version}.gz";
5 hash = "sha256-WLOCTIDdO6kIsMytUdbhZx4woj/u1gf7jmORR2i8T4U=";
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-H500OF6jqnzXwH+jiNwlgQrqnTwz4mDHE6Olhz1w44Y=";
16 };
17
18 nativeBuildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.cracklib;
19 buildInputs = [ zlib gettext ];
20
21 postPatch = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
22 chmod +x util/cracklib-format
23 patchShebangs util
24
25 '' + ''
26 ln -vs ${toString wordlists} dicts/
27 '';
28
29 postInstall = ''
30 make dict-local
31 '';
32 doInstallCheck = true;
33 installCheckTarget = "test";
34
35 meta = with lib; {
36 homepage = "https://github.com/cracklib/cracklib";
37 description = "A library for checking the strength of passwords";
38 license = licenses.lgpl21; # Different license for the wordlist: http://www.openwall.com/wordlists
39 maintainers = with maintainers; [ lovek323 ];
40 platforms = platforms.unix;
41 };
42}