From a0fcd515e120ab29ea15b153197384a7778ee1cb Mon Sep 17 00:00:00 2001 From: Aleksandr Lebedev Date: Wed, 29 Oct 2025 09:11:22 +0100 Subject: [PATCH] Fixed (hopefully) freezes of entire system because of suspend Thanks Systemd --- modules/nixos/presets/default/default.nix | 4 +++- modules/nixos/presets/default/unfreeze-systemd.nix | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 modules/nixos/presets/default/unfreeze-systemd.nix diff --git a/modules/nixos/presets/default/default.nix b/modules/nixos/presets/default/default.nix index e24cc34..d9e572a 100644 --- a/modules/nixos/presets/default/default.nix +++ b/modules/nixos/presets/default/default.nix @@ -12,7 +12,9 @@ in { options.${namespace}.presets.default = with types; { enable = mkBoolOpt false "Enable preset with all the default settings - locale, time, etc"; }; - + imports = [ + ./systemd-unfreeze.nix + ]; config = mkIf cfg.enable { zramSwap = { enable = true; # Hopefully? helps with freezing when using swap diff --git a/modules/nixos/presets/default/unfreeze-systemd.nix b/modules/nixos/presets/default/unfreeze-systemd.nix new file mode 100644 index 0000000..c900e5a --- /dev/null +++ b/modules/nixos/presets/default/unfreeze-systemd.nix @@ -0,0 +1,14 @@ +# https://t.me/s/tazlog/65 +# https://cl.tvl.fyi/c/depot/+/12961 +# Workaround for disabling semi-broken systemd user slice freezing (whatever +# that is). This can cause machines to become unusable after resume. +let + override.environment.SYSTEMD_SLEEP_FREEZE_USER_SESSIONS = "false"; +in { + systemd.services = { + systemd-suspend = override; + systemd-hibernate = override; + systemd-hybrid-sleep = override; + systemd-suspend-then-hibernate = override; + }; +}