summaryrefslogtreecommitdiff
path: root/nixos/suspend.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/suspend.nix')
-rw-r--r--nixos/suspend.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/suspend.nix b/nixos/suspend.nix
new file mode 100644
index 0000000..11404de
--- /dev/null
+++ b/nixos/suspend.nix
@@ -0,0 +1,18 @@
+{ lib, config, ... }: let
+ cfg = config.systemd._suspend;
+in {
+ options.systemd._suspend = {
+ disable = lib.mkEnableOption "disables suspend";
+ };
+
+ config = lib.mkIf cfg.disable {
+ # Disable suspend targets
+ systemd.targets = builtins.listToAttrs (map (name: {
+ inherit name;
+ value = {
+ enable = false;
+ unitConfig.DefaultDependencies = "no";
+ };
+ }) ["sleep" "suspend" "hibernate" "hybrid-sleep"]);
+ };
+}