diff options
author | Will Fancher <elvishjerricco@gmail.com> | 2023-11-09 04:22:05 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 04:22:05 -0500 |
commit | 2f73652c34718590a98c8682a8a77fc156fbe37f (patch) | |
tree | 4baf84fb8afd16d9e48c5eb450a027a1402c4027 /nixos/modules | |
parent | 9b77428564e7d0541a1f04c94ad9246109efc933 (diff) | |
parent | 2a4b82c46141a91ca0c4c1401a7b2eb698d7c1c2 (diff) | |
download | nixlib-2f73652c34718590a98c8682a8a77fc156fbe37f.tar nixlib-2f73652c34718590a98c8682a8a77fc156fbe37f.tar.gz nixlib-2f73652c34718590a98c8682a8a77fc156fbe37f.tar.bz2 nixlib-2f73652c34718590a98c8682a8a77fc156fbe37f.tar.lz nixlib-2f73652c34718590a98c8682a8a77fc156fbe37f.tar.xz nixlib-2f73652c34718590a98c8682a8a77fc156fbe37f.tar.zst nixlib-2f73652c34718590a98c8682a8a77fc156fbe37f.zip |
Merge pull request #240651 from accelbread/postresumecommands
nixos/boot: add postResumeCommands option
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/system/boot/stage-1-init.sh | 2 | ||||
-rw-r--r-- | nixos/modules/system/boot/stage-1.nix | 10 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd/initrd.nix | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index bac354b4724b..086e5d65da2f 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -495,6 +495,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 diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index f139902cdc85..322a234e0c43 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -316,7 +316,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 @@ -527,6 +527,14 @@ in ''; }; + boot.initrd.postResumeCommands = mkOption { + default = ""; + type = types.lines; + description = lib.mdDoc '' + Shell commands to be executed immediately after attempting to resume. + ''; + }; + boot.initrd.postMountCommands = mkOption { default = ""; type = types.lines; diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix index be40b8e969a1..e223451652b2 100644 --- a/nixos/modules/system/boot/systemd/initrd.nix +++ b/nixos/modules/system/boot/systemd/initrd.nix @@ -358,6 +358,7 @@ in { [ "preDeviceCommands" ] [ "preLVMCommands" ] [ "postDeviceCommands" ] + [ "postResumeCommands" ] [ "postMountCommands" ] [ "extraUdevRulesCommands" ] [ "extraUtilsCommands" ] |