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; + }; +}