289289
290290 # The init script of boot stage 1 (loading kernel modules for
291291 # mounting the root FS).
292- bootStage1 = pkgs . substituteAll {
292+ bootStage1 = pkgs . replaceVarsWith {
293293 src = ./stage-1-init.sh ;
294-
295- shell = "${ extraUtils } /bin/ash" ;
296-
297294 isExecutable = true ;
298295
299296 postInstall = ''
@@ -304,35 +301,39 @@ let
304301 ${ pkgs . buildPackages . busybox } /bin/ash -n $target
305302 '' ;
306303
307- inherit linkUnits udevRules extraUtils ;
304+ replacements = {
305+ shell = "${ extraUtils } /bin/ash" ;
308306
309- inherit ( config . boot ) resumeDevice ;
307+ inherit linkUnits udevRules extraUtils ;
310308
311- inherit ( config . system . nixos ) distroName ;
309+ inherit ( config . boot ) resumeDevice ;
312310
313- inherit ( config . system . build ) earlyMountScript ;
311+ inherit ( config . system . nixos ) distroName ;
314312
315- inherit ( config . boot . initrd ) checkJournalingFS verbose
316- preLVMCommands preDeviceCommands postDeviceCommands postResumeCommands postMountCommands preFailCommands kernelModules ;
313+ inherit ( config . system . build ) earlyMountScript ;
317314
318- resumeDevices = map ( sd : if sd ? device then sd . device else "/dev/disk/by-label/${ sd . label } " )
319- ( filter ( sd : hasPrefix "/dev/" sd . device && ! sd . randomEncryption . enable
320- # Don't include zram devices
321- && ! ( hasPrefix "/dev/zram" sd . device )
322- ) config . swapDevices ) ;
315+ inherit ( config . boot . initrd ) checkJournalingFS verbose
316+ preLVMCommands preDeviceCommands postDeviceCommands postResumeCommands postMountCommands preFailCommands kernelModules ;
323317
324- fsInfo =
325- let f = fs : [ fs . mountPoint ( if fs . device != null then fs . device else "/dev/disk/by-label/${ fs . label } " ) fs . fsType ( builtins . concatStringsSep "," fs . options ) ] ;
326- in pkgs . writeText "initrd-fsinfo" ( concatStringsSep "\n " ( concatMap f fileSystems ) ) ;
318+ resumeDevices = map ( sd : if sd ? device then sd . device else "/dev/disk/by-label/${ sd . label } " )
319+ ( filter ( sd : hasPrefix "/dev/" sd . device && ! sd . randomEncryption . enable
320+ # Don't include zram devices
321+ && ! ( hasPrefix "/dev/zram" sd . device )
322+ ) config . swapDevices ) ;
327323
328- setHostId = optionalString ( config . networking . hostId != null ) ''
329- hi="${ config . networking . hostId } "
330- ${ if pkgs . stdenv . hostPlatform . isBigEndian then ''
331- echo -ne "\x'' ${hi:0:2}\x'' ${hi:2:2}\x'' ${hi:4:2}\x'' ${hi:6:2}" > /etc/hostid
332- '' else ''
333- echo -ne "\x'' ${hi:6:2}\x'' ${hi:4:2}\x'' ${hi:2:2}\x'' ${hi:0:2}" > /etc/hostid
334- '' }
335- '' ;
324+ fsInfo =
325+ let f = fs : [ fs . mountPoint ( if fs . device != null then fs . device else "/dev/disk/by-label/${ fs . label } " ) fs . fsType ( builtins . concatStringsSep "," fs . options ) ] ;
326+ in pkgs . writeText "initrd-fsinfo" ( concatStringsSep "\n " ( concatMap f fileSystems ) ) ;
327+
328+ setHostId = optionalString ( config . networking . hostId != null ) ''
329+ hi="${ config . networking . hostId } "
330+ ${ if pkgs . stdenv . hostPlatform . isBigEndian then ''
331+ echo -ne "\x'' ${hi:0:2}\x'' ${hi:2:2}\x'' ${hi:4:2}\x'' ${hi:6:2}" > /etc/hostid
332+ '' else ''
333+ echo -ne "\x'' ${hi:6:2}\x'' ${hi:4:2}\x'' ${hi:2:2}\x'' ${hi:0:2}" > /etc/hostid
334+ '' }
335+ '' ;
336+ } ;
336337 } ;
337338
338339
0 commit comments