mirror of
https://github.com/nix-community/disko.git
synced 2026-12-01 05:23:28 +01:00
apply treefmt
This commit is contained in:
1 parent
049d1bd952
commit
b32f0e2876
15 files changed
+279
-257
No files matched your search
+13
-11
@@ -91,17 +91,19 @@
|
||||
let
|
||||
subvolMounts = lib.concatMapAttrs
|
||||
(_: subvol:
|
||||
lib.warnIf (subvol.mountOptions != (options.subvolumes.type.getSubOptions []).mountOptions.default && subvol.mountpoint == null)
|
||||
"Subvolume ${subvol.name} has mountOptions but no mountpoint. See upgrade guide (2023-07-09 121df48)."
|
||||
lib.optionalAttrs (subvol.mountpoint != null) {
|
||||
${subvol.mountpoint} = ''
|
||||
if ! findmnt ${config.device} "${rootMountPoint}${subvol.mountpoint}" > /dev/null 2>&1; then
|
||||
mount ${config.device} "${rootMountPoint}${subvol.mountpoint}" \
|
||||
${lib.concatMapStringsSep " " (opt: "-o ${opt}") (subvol.mountOptions ++ [ "subvol=${subvol.name}" ])} \
|
||||
-o X-mount.mkdir
|
||||
fi
|
||||
'';
|
||||
}
|
||||
lib.warnIf (subvol.mountOptions != (options.subvolumes.type.getSubOptions [ ]).mountOptions.default && subvol.mountpoint == null)
|
||||
"Subvolume ${subvol.name} has mountOptions but no mountpoint. See upgrade guide (2023-07-09 121df48)."
|
||||
lib.optionalAttrs
|
||||
(subvol.mountpoint != null)
|
||||
{
|
||||
${subvol.mountpoint} = ''
|
||||
if ! findmnt ${config.device} "${rootMountPoint}${subvol.mountpoint}" > /dev/null 2>&1; then
|
||||
mount ${config.device} "${rootMountPoint}${subvol.mountpoint}" \
|
||||
${lib.concatMapStringsSep " " (opt: "-o ${opt}") (subvol.mountOptions ++ [ "subvol=${subvol.name}" ])} \
|
||||
-o X-mount.mkdir
|
||||
fi
|
||||
'';
|
||||
}
|
||||
)
|
||||
config.subvolumes;
|
||||
in
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = lib.replaceStrings ["/"] ["_"] config._module.args.name;
|
||||
default = lib.replaceStrings [ "/" ] [ "_" ] config._module.args.name;
|
||||
description = "Device name";
|
||||
};
|
||||
type = lib.mkOption {
|
||||
@@ -39,13 +39,13 @@
|
||||
};
|
||||
_mount = diskoLib.mkMountOption {
|
||||
inherit config options;
|
||||
default = lib.optionalAttrs (config.content != null) (config.content._mount);
|
||||
default = lib.optionalAttrs (config.content != null) config.content._mount;
|
||||
};
|
||||
_config = lib.mkOption {
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
default =
|
||||
lib.optional (config.content != null) (config.content._config);
|
||||
lib.optional (config.content != null) config.content._config;
|
||||
description = "NixOS configuration";
|
||||
};
|
||||
_pkgs = lib.mkOption {
|
||||
|
||||
+12
-11
@@ -24,11 +24,12 @@ in
|
||||
};
|
||||
device = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = if config._parent.type == "mdadm" then
|
||||
default =
|
||||
if config._parent.type == "mdadm" then
|
||||
# workaround because mdadm partlabel do not appear in /dev/disk/by-partlabel
|
||||
"/dev/disk/by-id/md-name-any:${config._parent.name}-part${toString partition.config._index}"
|
||||
else
|
||||
"/dev/disk/by-partlabel/${partition.config.label}";
|
||||
"/dev/disk/by-id/md-name-any:${config._parent.name}-part${toString partition.config._index}"
|
||||
else
|
||||
"/dev/disk/by-partlabel/${partition.config.label}";
|
||||
description = "Device to use for the partition";
|
||||
};
|
||||
priority = lib.mkOption {
|
||||
@@ -130,13 +131,13 @@ in
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
default = (map
|
||||
(partition:
|
||||
lib.optional (partition.content != null) partition.content._config
|
||||
)
|
||||
(lib.attrValues config.partitions))
|
||||
++ (lib.optional (lib.any (part: part.type == "EF02") (lib.attrValues config.partitions)) {
|
||||
boot.loader.grub.devices = [ config.device ];
|
||||
});
|
||||
(partition:
|
||||
lib.optional (partition.content != null) partition.content._config
|
||||
)
|
||||
(lib.attrValues config.partitions))
|
||||
++ (lib.optional (lib.any (part: part.type == "EF02") (lib.attrValues config.partitions)) {
|
||||
boot.loader.grub.devices = [ config.device ];
|
||||
});
|
||||
description = "NixOS configuration";
|
||||
};
|
||||
_pkgs = lib.mkOption {
|
||||
|
||||
+10
-9
@@ -1,6 +1,7 @@
|
||||
{ config, options, lib, diskoLib, parent, device, ... }:
|
||||
let
|
||||
keyFile = if lib.hasAttr "keyFile" config.settings
|
||||
keyFile =
|
||||
if lib.hasAttr "keyFile" config.settings
|
||||
then config.settings.keyFile
|
||||
else if config.keyFile != null
|
||||
then lib.warn "The option `keyFile` is deprecated. See the `settings` option." config.keyFile
|
||||
@@ -46,9 +47,9 @@ in
|
||||
};
|
||||
additionalKeyFiles = lib.mkOption {
|
||||
type = lib.types.listOf diskoLib.optionTypes.absolute-pathname;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "Path to additional key files for encryption";
|
||||
example = ["/tmp/disk2.key"];
|
||||
example = [ "/tmp/disk2.key" ];
|
||||
};
|
||||
initrdUnlock = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
@@ -114,12 +115,12 @@ in
|
||||
default = [ ]
|
||||
# If initrdUnlock is true, then add a device entry to the initrd.luks.devices config.
|
||||
++ (lib.optional config.initrdUnlock [
|
||||
{
|
||||
boot.initrd.luks.devices.${config.name} = {
|
||||
inherit (config) device;
|
||||
} // config.settings;
|
||||
}
|
||||
]) ++ (lib.optional (config.content != null) config.content._config);
|
||||
{
|
||||
boot.initrd.luks.devices.${config.name} = {
|
||||
inherit (config) device;
|
||||
} // config.settings;
|
||||
}
|
||||
]) ++ (lib.optional (config.content != null) config.content._config);
|
||||
description = "NixOS configuration";
|
||||
};
|
||||
_pkgs = lib.mkOption {
|
||||
|
||||
Reference in new issue
Block a user