mirror of
https://github.com/nix-community/disko
synced 2024-09-20 14:01:56 +00:00
filesystem/nodev: mountpoint can be empty
This commit is contained in:
parent
cf705ee161
commit
2785974eef
2 changed files with 9 additions and 8 deletions
|
@ -17,7 +17,8 @@
|
||||||
description = "Options to pass to mount";
|
description = "Options to pass to mount";
|
||||||
};
|
};
|
||||||
mountpoint = lib.mkOption {
|
mountpoint = lib.mkOption {
|
||||||
type = optionTypes.absolute-pathname;
|
type = lib.types.nullOr optionTypes.absolute-pathname;
|
||||||
|
default = null;
|
||||||
description = "Path to mount the filesystem to";
|
description = "Path to mount the filesystem to";
|
||||||
};
|
};
|
||||||
format = lib.mkOption {
|
format = lib.mkOption {
|
||||||
|
@ -41,7 +42,7 @@
|
||||||
};
|
};
|
||||||
_mount = diskoLib.mkMountOption {
|
_mount = diskoLib.mkMountOption {
|
||||||
inherit config options;
|
inherit config options;
|
||||||
default = { dev }: {
|
default = { dev }: lib.optionalAttrs (config.mountpoint != null) {
|
||||||
fs.${config.mountpoint} = ''
|
fs.${config.mountpoint} = ''
|
||||||
if ! findmnt ${dev} "${rootMountPoint}${config.mountpoint}" > /dev/null 2>&1; then
|
if ! findmnt ${dev} "${rootMountPoint}${config.mountpoint}" > /dev/null 2>&1; then
|
||||||
mount ${dev} "${rootMountPoint}${config.mountpoint}" \
|
mount ${dev} "${rootMountPoint}${config.mountpoint}" \
|
||||||
|
@ -55,13 +56,13 @@
|
||||||
_config = lib.mkOption {
|
_config = lib.mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = dev: [{
|
default = dev: lib.optional (config.mountpoint != null) {
|
||||||
fileSystems.${config.mountpoint} = {
|
fileSystems.${config.mountpoint} = {
|
||||||
device = dev;
|
device = dev;
|
||||||
fsType = config.format;
|
fsType = config.format;
|
||||||
options = config.mountOptions;
|
options = config.mountOptions;
|
||||||
};
|
};
|
||||||
}];
|
};
|
||||||
description = "NixOS configuration";
|
description = "NixOS configuration";
|
||||||
};
|
};
|
||||||
_pkgs = lib.mkOption {
|
_pkgs = lib.mkOption {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
description = "Device to use";
|
description = "Device to use";
|
||||||
};
|
};
|
||||||
mountpoint = lib.mkOption {
|
mountpoint = lib.mkOption {
|
||||||
type = optionTypes.absolute-pathname;
|
type = lib.types.nullOr optionTypes.absolute-pathname;
|
||||||
default = config._module.args.name;
|
default = config._module.args.name;
|
||||||
description = "Location to mount the file system at";
|
description = "Location to mount the file system at";
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
};
|
};
|
||||||
_mount = diskoLib.mkMountOption {
|
_mount = diskoLib.mkMountOption {
|
||||||
inherit config options;
|
inherit config options;
|
||||||
default = _: {
|
default = _: lib.optionalAttrs (config.mountpoint != null) {
|
||||||
fs.${config.mountpoint} = ''
|
fs.${config.mountpoint} = ''
|
||||||
if ! findmnt ${config.fsType} "${rootMountPoint}${config.mountpoint}" > /dev/null 2>&1; then
|
if ! findmnt ${config.fsType} "${rootMountPoint}${config.mountpoint}" > /dev/null 2>&1; then
|
||||||
mount -t ${config.fsType} ${config.device} "${rootMountPoint}${config.mountpoint}" \
|
mount -t ${config.fsType} ${config.device} "${rootMountPoint}${config.mountpoint}" \
|
||||||
|
@ -52,13 +52,13 @@
|
||||||
_config = lib.mkOption {
|
_config = lib.mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = [{
|
default = lib.optional (config.mountpoint != null) {
|
||||||
fileSystems.${config.mountpoint} = {
|
fileSystems.${config.mountpoint} = {
|
||||||
device = config.device;
|
device = config.device;
|
||||||
fsType = config.fsType;
|
fsType = config.fsType;
|
||||||
options = config.mountOptions;
|
options = config.mountOptions;
|
||||||
};
|
};
|
||||||
}];
|
};
|
||||||
description = "NixOS configuration";
|
description = "NixOS configuration";
|
||||||
};
|
};
|
||||||
_pkgs = lib.mkOption {
|
_pkgs = lib.mkOption {
|
||||||
|
|
Loading…
Reference in a new issue