summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorTomas Antonio Lopez <entropy.overseer@entropic.network>2020-12-28 00:09:42 +0900
committerTomas Antonio Lopez <entropy.overseer@entropic.network>2021-05-19 21:23:35 +0900
commitb922fa959b06179c712f20f2d3c8f71cffe95abb (patch)
tree9d085950bf39d44d39f0dfa19416496d25488095 /nixos/modules/config
parent4226837368068600e6afd11b5cbc6d586c7b5fa9 (diff)
downloadnixpkgs-b922fa959b06179c712f20f2d3c8f71cffe95abb.tar
nixpkgs-b922fa959b06179c712f20f2d3c8f71cffe95abb.tar.gz
nixpkgs-b922fa959b06179c712f20f2d3c8f71cffe95abb.tar.bz2
nixpkgs-b922fa959b06179c712f20f2d3c8f71cffe95abb.tar.lz
nixpkgs-b922fa959b06179c712f20f2d3c8f71cffe95abb.tar.xz
nixpkgs-b922fa959b06179c712f20f2d3c8f71cffe95abb.tar.zst
nixpkgs-b922fa959b06179c712f20f2d3c8f71cffe95abb.zip
nixos/swap: add discardPolicy option
Add option for activating discards on swap partitions (none, once, pages and both).
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/swap.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix
index 59bc9e9d11e..a37b46b8c46 100644
--- a/nixos/modules/config/swap.nix
+++ b/nixos/modules/config/swap.nix
@@ -114,6 +114,19 @@ let
         '';
       };
 
+      discardPolicy = mkOption {
+        default = null;
+        example = "once";
+        type = types.nullOr (types.enum ["once" "pages" "both" ]);
+        description = ''
+          Specify the discard policy for the swap device. If "once", then the
+          whole swap space is discarded at swapon invocation. If "pages",
+          asynchronous discard on freed pages is performed, before returning to
+          the available pages pool. With "both", both policies are activated.
+          See swapon(8) for more information.
+        '';
+      };
+
       deviceName = mkOption {
         type = types.str;
         internal = true;