forked from mirrors/nixpkgs
Merge pull request #107728 from nessdoor/master
This commit is contained in:
commit
2b49e4e735
|
@ -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;
|
||||
|
|
|
@ -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!
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue