diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index 4a2ecd11e103..df4165fbbec5 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -81,8 +81,8 @@ in fi echo "vm.mmap_rnd_bits=$mmap_rnd_bits_max" >> $out '' - # HAVE_ARCH_MMAP_RND_COMPAT_BITS is not defined for LoongArch64 - + lib.optionalString (!pkgs.stdenv.hostPlatform.isLoongArch64) '' + # HAVE_ARCH_MMAP_RND_COMPAT_BITS is not defined on 32-bit architectures or LoongArch64 + + lib.optionalString (with pkgs.stdenv.hostPlatform; (!is32bit && !isLoongArch64)) '' mmap_rnd_compat_bits_max=$(grep "^CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=" $configfile | grep --only-matching "[0-9]*$") if [[ -z "$mmap_rnd_compat_bits_max" ]]; then echo "Unable to determine mmap_rnd_compat_bits_max. Check your kernel configfile is valid."