summaryrefslogtreecommitdiffstats
path: root/nixos/modules/tasks/filesystems.nix
diff options
context:
space:
mode:
authorjakobrs <jakobrs100@gmail.com>2020-05-21 09:10:47 +0200
committerjakobrs <jakobrs100@gmail.com>2021-06-08 18:51:31 +0200
commitb07602a604d6d5db3b1ff85d1c3c008ad25245fa (patch)
treec0a9b740b761540b69a0639857f06c38793a5142 /nixos/modules/tasks/filesystems.nix
parentc8e32eddf825bdec9d510185357cb887622531f9 (diff)
nixos/lib, nixos/filesystems: Make fsBefore more stable, and add `depends` option
Diffstat (limited to 'nixos/modules/tasks/filesystems.nix')
-rw-r--r--nixos/modules/tasks/filesystems.nix20
1 files changed, 18 insertions, 2 deletions
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index 065d6cc95d18..2949c82df8fe 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -24,13 +24,15 @@ let
specialFSTypes = [ "proc" "sysfs" "tmpfs" "ramfs" "devtmpfs" "devpts" ];
+ nonEmptyWithoutTrailingSlash = addCheckDesc "non-empty without trailing slash" types.str
+ (s: isNonEmpty s && (builtins.match ".+/" s) == null);
+
coreFileSystemOpts = { name, config, ... }: {
options = {
mountPoint = mkOption {
example = "/mnt/usb";
- type = addCheckDesc "non-empty without trailing slash" types.str
- (s: isNonEmpty s && (builtins.match ".+/" s) == null);
+ type = nonEmptyWithoutTrailingSlash;
description = "Location of the mounted the file system.";
};
@@ -55,6 +57,20 @@ let
type = types.listOf nonEmptyStr;
};
+ depends = mkOption {
+ default = [ ];
+ example = [ "/persist" ];
+ type = types.listOf nonEmptyWithoutTrailingSlash;
+ description = ''
+ List of paths that should be mounted before this one. This filesystem's
+ <option>device</option> and <option>mountPoint</option> are always
+ checked and do not need to be included explicitly. If a path is added
+ to this list, any other filesystem whose mount point is a parent of
+ the path will be mounted before this filesystem. The paths do not need
+ to actually be the <option>mountPoint</option> of some other filesystem.
+ '';
+ };
+
};
config = {