nixos: fix message on failure to determine mmap ASLR entropy

Previously the script would stop early without any explanation. Now it
continues to the point where the proper error message is printed, and then
exits with an error exit status.
This commit is contained in:
Yureka
2026-06-19 12:04:18 +02:00
parent 7e03a6a2f0
commit d8b16de49d
+4
View File
@@ -74,7 +74,9 @@ in
}
(
''
set +e
mmap_rnd_bits_max=$(grep "^CONFIG_ARCH_MMAP_RND_BITS_MAX=" $configfile | grep --only-matching "[0-9]*$")
set -e
if [[ -z "$mmap_rnd_bits_max" ]]; then
echo "Unable to determine mmap_rnd_bits_max. Check your kernel configfile is valid."
exit 1
@@ -83,7 +85,9 @@ in
''
# HAVE_ARCH_MMAP_RND_COMPAT_BITS is not defined on 32-bit architectures or LoongArch64
+ lib.optionalString (with pkgs.stdenv.hostPlatform; (!is32bit && !isLoongArch64)) ''
set +e
mmap_rnd_compat_bits_max=$(grep "^CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=" $configfile | grep --only-matching "[0-9]*$")
set -e
if [[ -z "$mmap_rnd_compat_bits_max" ]]; then
echo "Unable to determine mmap_rnd_compat_bits_max. Check your kernel configfile is valid."
exit 1