Skip to content

Commit

Permalink
zfs resume fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aecay committed Feb 13, 2023
1 parent 6d87734 commit 727eac8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions nixos/modules/system/boot/stage-1-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ if test -e /sys/power/resume -a -e /sys/power/disk; then
fi
fi
@postResumeCommands@
# If we have a path to an iso file, find the iso and link it to /dev/root
if [ -n "$isoPath" ]; then
mkdir -p /findiso
Expand Down
13 changes: 12 additions & 1 deletion nixos/modules/system/boot/stage-1.nix
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ let
inherit (config.system.build) earlyMountScript;

inherit (config.boot.initrd) checkJournalingFS verbose
preLVMCommands preDeviceCommands postDeviceCommands postMountCommands preFailCommands kernelModules;
preLVMCommands preDeviceCommands postDeviceCommands postResumeCommands postMountCommands preFailCommands kernelModules;

resumeDevices = map (sd: if sd ? device then sd.device else "/dev/disk/by-label/${sd.label}")
(filter (sd: hasPrefix "/dev/" sd.device && !sd.randomEncryption.enable
Expand Down Expand Up @@ -537,6 +537,17 @@ in
'';
};

boot.initrd.postResumeCommands = mkOption {
default = "";
type = types.lines;
description = lib.mdDoc ''
Shell commands to be executed immediately after stage 1 of the
boot has attempted to resume from hibernation. These commands
will only be run if the resume attempt did not take effect.
'';
};


boot.initrd.postMountCommands = mkOption {
default = "";
type = types.lines;
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/tasks/filesystems/zfs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ in
$out/bin/zfs --help >/dev/null 2>&1
$out/bin/zpool --help >/dev/null 2>&1
'';
postDeviceCommands = concatStringsSep "\n" ([''
postResumeCommands = concatStringsSep "\n" ([''
ZFS_FORCE="${optionalString cfgZfs.forceImportRoot "-f"}"
''] ++ [(importLib {
# See comments at importLib definition.
Expand Down

0 comments on commit 727eac8

Please sign in to comment.