3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #107728 from nessdoor/master

This commit is contained in:
Sandro 2021-06-15 14:40:21 +02:00 committed by GitHub
commit 2b49e4e735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -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;

View file

@ -254,8 +254,11 @@ in
skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck;
# https://wiki.archlinux.org/index.php/fstab#Filepath_spaces
escape = string: builtins.replaceStrings [ " " "\t" ] [ "\\040" "\\011" ] string;
swapOptions = sw: "defaults"
+ optionalString (sw.priority != null) ",pri=${toString sw.priority}";
swapOptions = sw: concatStringsSep "," (
[ "defaults" ]
++ optional (sw.priority != null) "pri=${toString sw.priority}"
++ optional (sw.discardPolicy != null) "discard${optionalString (sw.discardPolicy != "both") "=${toString sw.discardPolicy}"}"
);
in ''
# This is a generated file. Do not edit!
#