mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
nixos/filesystems: chore replace 'with' statements
This commit is contained in:
parent
98ce1f5ab8
commit
6e25d9885f
1 changed files with 28 additions and 10 deletions
|
@ -5,11 +5,31 @@
|
||||||
utils,
|
utils,
|
||||||
...
|
...
|
||||||
}@moduleArgs:
|
}@moduleArgs:
|
||||||
|
|
||||||
with lib;
|
|
||||||
with utils;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib)
|
||||||
|
any
|
||||||
|
attrValues
|
||||||
|
concatMapStrings
|
||||||
|
concatMapStringsSep
|
||||||
|
concatStringsSep
|
||||||
|
elem
|
||||||
|
filter
|
||||||
|
flip
|
||||||
|
head
|
||||||
|
literalExpression
|
||||||
|
mkDefault
|
||||||
|
mkEnableOption
|
||||||
|
mkIf
|
||||||
|
mkMerge
|
||||||
|
mkOption
|
||||||
|
optional
|
||||||
|
optionalAttrs
|
||||||
|
optionalString
|
||||||
|
toposort
|
||||||
|
types
|
||||||
|
;
|
||||||
|
inherit (utils) fsBefore;
|
||||||
|
|
||||||
# https://wiki.archlinux.org/index.php/fstab#Filepath_spaces
|
# https://wiki.archlinux.org/index.php/fstab#Filepath_spaces
|
||||||
escape = string: builtins.replaceStrings [ " " "\t" ] [ "\\040" "\\011" ] string;
|
escape = string: builtins.replaceStrings [ " " "\t" ] [ "\\040" "\\011" ] string;
|
||||||
|
|
||||||
|
@ -61,7 +81,7 @@ let
|
||||||
description = "Location of the mounted file system.";
|
description = "Location of the mounted file system.";
|
||||||
};
|
};
|
||||||
|
|
||||||
stratis.poolUuid = lib.mkOption {
|
stratis.poolUuid = mkOption {
|
||||||
type = types.uniq (types.nullOr types.str);
|
type = types.uniq (types.nullOr types.str);
|
||||||
description = ''
|
description = ''
|
||||||
UUID of the stratis pool that the fs is located in
|
UUID of the stratis pool that the fs is located in
|
||||||
|
@ -166,9 +186,7 @@ let
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config.device = lib.mkIf (config.label != null) (
|
config.device = mkIf (config.label != null) (mkDefault "/dev/disk/by-label/${escape config.label}");
|
||||||
lib.mkDefault "/dev/disk/by-label/${escape config.label}"
|
|
||||||
);
|
|
||||||
|
|
||||||
config.options =
|
config.options =
|
||||||
let
|
let
|
||||||
|
@ -320,7 +338,7 @@ in
|
||||||
|
|
||||||
boot.supportedFilesystems = mkOption {
|
boot.supportedFilesystems = mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
example = lib.literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
btrfs = true;
|
btrfs = true;
|
||||||
zfs = lib.mkForce false;
|
zfs = lib.mkForce false;
|
||||||
|
@ -471,7 +489,7 @@ in
|
||||||
# Filesystems.
|
# Filesystems.
|
||||||
${makeFstabEntries fileSystems { }}
|
${makeFstabEntries fileSystems { }}
|
||||||
|
|
||||||
${lib.optionalString (config.swapDevices != [ ]) "# Swap devices."}
|
${optionalString (config.swapDevices != [ ]) "# Swap devices."}
|
||||||
${flip concatMapStrings config.swapDevices (sw: "${sw.realDevice} none swap ${swapOptions sw}\n")}
|
${flip concatMapStrings config.swapDevices (sw: "${sw.realDevice} none swap ${swapOptions sw}\n")}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue