summaryrefslogtreecommitdiff
path: root/modules/root/suspend.nix
diff options
context:
space:
mode:
authorTim Keller <tjkeller.xyz>2025-02-09 16:53:01 -0600
committerTim Keller <tjkeller.xyz>2025-02-09 16:53:01 -0600
commitfcc3434b1ccaca1c86223d015227858b0a0a2688 (patch)
tree5a5817eabcb77f5be9baac77ad304e6d4cdb97cb /modules/root/suspend.nix
parent3bc77c8dae2a5bf06789ae80cc0356d271660d62 (diff)
downloadnixos-fcc3434b1ccaca1c86223d015227858b0a0a2688.tar.xz
nixos-fcc3434b1ccaca1c86223d015227858b0a0a2688.zip
cleanup and small fixes
Diffstat (limited to 'modules/root/suspend.nix')
-rw-r--r--modules/root/suspend.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/root/suspend.nix b/modules/root/suspend.nix
new file mode 100644
index 0000000..814ae95
--- /dev/null
+++ b/modules/root/suspend.nix
@@ -0,0 +1,16 @@
+{ lib, config, ... }: {
+ options = {
+ suspend.enable = lib.mkEnableOption "enables suspend";
+ };
+
+ config = lib.mkIf (! config.suspend.enable) {
+ # Disable suspend targets
+ systemd.targets = builtins.listToAttrs (map (name: {
+ inherit name;
+ value = {
+ enable = false;
+ unitConfig.DefaultDependencies = "no";
+ };
+ }) ["sleep" "suspend" "hibernate" "hybrid-sleep"]);
+ };
+}