···88888989 inherit src;
90909191- patches = map (p: p.patch) kernelPatches;
9191+ patches =
9292+ map (p: p.patch) kernelPatches
9393+ # Required for deterministic builds along with some postPatch magic.
9494+ ++ optional (stdenv.lib.versionAtLeast version "4.13") ./randstruct-provide-seed.patch;
92959396 prePatch = ''
9497 for mf in $(find -name Makefile -o -name Makefile.include -o -name install.sh); do
···97100 done
98101 sed -i Makefile -e 's|= depmod|= ${buildPackages.kmod}/bin/depmod|'
99102 sed -i scripts/ld-version.sh -e "s|/usr/bin/awk|${buildPackages.gawk}/bin/awk|"
103103+ '';
104104+105105+ postPatch = ''
106106+ # Set randstruct seed to a deterministic but diversified value. Note:
107107+ # we could have instead patched gen-random-seed.sh to take input from
108108+ # the buildFlags, but that would require also patching the kernel's
109109+ # toplevel Makefile to add a variable export. This would be likely to
110110+ # cause future patch conflicts.
111111+ if [ -f scripts/gcc-plugins/gen-random-seed.sh ]; then
112112+ substituteInPlace scripts/gcc-plugins/gen-random-seed.sh \
113113+ --replace NIXOS_RANDSTRUCT_SEED \
114114+ $(echo ${src} ${configfile} | sha256sum | cut -d ' ' -f 1 | tr -d '\n')
115115+ fi
100116 '';
101117102118 configurePhase = ''