diff --git a/pkgs/development/libraries/nss/default.nix b/pkgs/development/libraries/nss/default.nix index 395617aa7bce2..0c51fda53822f 100644 --- a/pkgs/development/libraries/nss/default.nix +++ b/pkgs/development/libraries/nss/default.nix @@ -1,4 +1,8 @@ -{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja }: +{ stdenv, fetchurl, nspr, perl, zlib, sqlite, darwin, fixDarwinDylibNames, buildPackages, ninja +, # allow FIPS mode. Note that this makes the output non-reproducible. + # https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Tech_Notes/nss_tech_note6 + enableFIPS ? false +}: let nssPEM = fetchurl { @@ -83,6 +87,7 @@ in stdenv.mkDerivation rec { -Dhost_arch=${host} \ -Duse_system_zlib=1 \ --enable-libpkix \ + ${stdenv.lib.optionalString enableFIPS "--enable-fips"} \ ${stdenv.lib.optionalString stdenv.isDarwin "--clang"} \ ${stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "--disable-tests"} @@ -128,7 +133,8 @@ in stdenv.mkDerivation rec { postFixup = let isCross = stdenv.hostPlatform != stdenv.buildPlatform; nss = if isCross then buildPackages.nss.tools else "$out"; - in '' + in + (stdenv.lib.optionalString enableFIPS '' for libname in freebl3 nssdbm3 softokn3 do '' + (if stdenv.isDarwin @@ -141,7 +147,8 @@ in stdenv.mkDerivation rec { '') + '' ${nss}/bin/shlibsign -v -i "$libfile" done - + '') + + '' moveToOutput bin "$tools" moveToOutput bin/nss-config "$dev" moveToOutput lib/libcrmf.a "$dev" # needed by firefox, for example