mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-11 04:02:55 +03:00
nixos/filesystems: always write mount options for swap devices
According to fstab(5), unlike last two fields `fs_freq` and `fs_passno`, the 4-th field `fs_mntops` is NOT optional, though it works when omitted. For best-practice and easier to be parsed by other programs, we should always write `defaults` as default mount options for swap devices.
This commit is contained in:
parent
2539e11b58
commit
80a1336bb9
@ -22,8 +22,6 @@ let
|
||||
# their assertions too
|
||||
(attrValues config.fileSystems);
|
||||
|
||||
prioOption = prio: optionalString (prio != null) " pri=${toString prio}";
|
||||
|
||||
specialFSTypes = [ "proc" "sysfs" "tmpfs" "ramfs" "devtmpfs" "devpts" ];
|
||||
|
||||
coreFileSystemOpts = { name, config, ... }: {
|
||||
@ -240,6 +238,8 @@ 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}";
|
||||
in ''
|
||||
# This is a generated file. Do not edit!
|
||||
#
|
||||
@ -262,7 +262,7 @@ in
|
||||
|
||||
# Swap devices.
|
||||
${flip concatMapStrings config.swapDevices (sw:
|
||||
"${sw.realDevice} none swap${prioOption sw.priority}\n"
|
||||
"${sw.realDevice} none swap ${swapOptions sw}\n"
|
||||
)}
|
||||
'';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user