Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, perl 2# Update the enabled crypt scheme ids in passthru when the enabled hashes change 3, enableHashes ? "strong" 4, nixosTests 5, runCommand 6, python3 7}: 8 9stdenv.mkDerivation (finalAttrs: { 10 pname = "libxcrypt"; 11 version = "4.4.36"; 12 13 src = fetchurl { 14 url = "https://github.com/besser82/libxcrypt/releases/download/v${finalAttrs.version}/libxcrypt-${finalAttrs.version}.tar.xz"; 15 hash = "sha256-5eH0yu4KAd4q7ibjE4gH1tPKK45nKHlm0f79ZeH9iUM="; 16 }; 17 18 outputs = [ 19 "out" 20 "man" 21 ]; 22 23 configureFlags = [ 24 "--enable-hashes=${enableHashes}" 25 "--enable-obsolete-api=glibc" 26 "--disable-failure-tokens" 27 # required for musl, android, march=native 28 "--disable-werror" 29 ]; 30 31 # fixes: can't build x86_64-w64-mingw32 shared library unless -no-undefined is specified 32 makeFlags = lib.optionals stdenv.hostPlatform.isWindows [ "LDFLAGS=-no-undefined"] ; 33 34 nativeBuildInputs = [ 35 perl 36 ]; 37 38 enableParallelBuilding = true; 39 40 doCheck = true; 41 42 passthru = { 43 tests = { 44 inherit (nixosTests) login shadow; 45 46 passthruMatches = runCommand "libxcrypt-test-passthru-matches" { } '' 47 ${python3.interpreter} "${./check_passthru_matches.py}" ${lib.escapeShellArgs ([ finalAttrs.src enableHashes "--" ] ++ finalAttrs.passthru.enabledCryptSchemeIds)} 48 touch "$out" 49 ''; 50 }; 51 enabledCryptSchemeIds = [ 52 # https://github.com/besser82/libxcrypt/blob/v4.4.35/lib/hashes.conf 53 "y" # yescrypt 54 "gy" # gost_yescrypt 55 "7" # scrypt 56 "2b" # bcrypt 57 "2y" # bcrypt_y 58 "2a" # bcrypt_a 59 "6" # sha512crypt 60 ]; 61 }; 62 63 meta = with lib; { 64 changelog = "https://github.com/besser82/libxcrypt/blob/v${finalAttrs.version}/NEWS"; 65 description = "Extended crypt library for descrypt, md5crypt, bcrypt, and others"; 66 homepage = "https://github.com/besser82/libxcrypt/"; 67 platforms = platforms.all; 68 maintainers = with maintainers; [ dottedmag hexa ]; 69 license = licenses.lgpl21Plus; 70 }; 71})