I had the issue that my laptop does not wake after suspend but instead shows a black screen. In order to fix this I used the guide from ArchWiki.
The following solution works on Nix channel 24.05 with the latest kernel version kernel (6.10.2) set by boot.kernelPackages = pkgs.linuxPackages_latest;
.
You can fix it as follows:
- Create a file
sleep.patch
in the same directory as your NixOS configuration file with the following contents:
diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 5fb48b6..a147de6 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -3752,9 +3752,15 @@ void intel_bios_for_each_encoder(struct drm_i915_private *i915,
const struct intel_bios_encoder_data *devdata))
{
struct intel_bios_encoder_data *devdata;
+ const int IGNORE_INDEX = 1;
+ int curr_index = 0;
- list_for_each_entry(devdata, &i915->display.vbt.display_devices, node)
- func(i915, devdata);
+ list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
+ if (curr_index != IGNORE_INDEX) {
+ func(i915, devdata);
+ }
+ curr_index += 1;
+ }
}
static int intel_bios_vbt_show(struct seq_file *m, void *unused)
The issue is that there is a duplicate eDP entry, this patch explicitly ignores the second eDP entry.
- Add the following configuration to your Nix configuration to apply the patch:
boot.kernelPatches = [
{
name = "Fix freeze after sleep";
patch = ./sleep.patch ;
}
];
If possible, I recommend adding it to a hardware specific configuration file. This is because when applied to devices which don’t have this issue, the patch will likely break second displays.
- Apply the configuration, applying may take a while (possibly multiple hours) as the kernel needs to be recompiled.
I am sharing this because I myself could not find good resources and it took me multiple hours to put together a solution, I am relatively new at Nix and did not have previous experience applying patches. Let me know if there is a better approach to this!