mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 21:50:55 +00:00
filesystems: add priority option for swap devices.
Useful for setting up raid0-like load balancing for swap. By giving multiple swap devices the same prio.
This commit is contained in:
parent
085ccc8199
commit
4630ad4d26
|
@ -58,6 +58,17 @@ with utils;
|
|||
'';
|
||||
};
|
||||
|
||||
priority = mkOption {
|
||||
default = null;
|
||||
example = 2048;
|
||||
type = types.nullOr types.int;
|
||||
description = ''
|
||||
Specify the priority of the swap device. Priority is a value between 0 and 32767.
|
||||
Higher numbers indicate higher priority.
|
||||
null lets the kernel choose a priority, which will show up as a negative value.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = {
|
||||
|
|
|
@ -7,6 +7,8 @@ let
|
|||
|
||||
fileSystems = attrValues config.fileSystems;
|
||||
|
||||
prioOption = prio: optionalString (prio !=null) " pri=${toString prio}";
|
||||
|
||||
fileSystemOpts = { name, ... }: {
|
||||
|
||||
options = {
|
||||
|
@ -167,7 +169,7 @@ in
|
|||
|
||||
# Swap devices.
|
||||
${flip concatMapStrings config.swapDevices (sw:
|
||||
"${sw.device} none swap\n"
|
||||
"${sw.device} none swap${prioOption sw.priority}\n"
|
||||
)}
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue