types: pass parent node to all subTypes

This commit is contained in:
lassulus committed 2023-06-16 21:11:44 +02:00
1 parent e0179917d8
commit 62f939e213
15 files changed
+79 -27

No files matched your search

+5 -1
View File
@@ -1,4 +1,4 @@
{ config, options, diskoLib, lib, rootMountPoint, ... }:
{ config, options, diskoLib, lib, rootMountPoint, parent, ... }:
{
options = {
type = lib.mkOption {
@@ -55,6 +55,10 @@
default = null;
description = "A path to mount the BTRFS filesystem to.";
};
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+1 -1
View File
@@ -16,7 +16,7 @@
type = diskoLib.optionTypes.absolute-pathname; # TODO check if subpath of /dev ? - No! eg: /.swapfile
description = "Device path";
};
content = diskoLib.deviceType;
content = diskoLib.deviceType { parent = config; };
_meta = lib.mkOption {
internal = true;
readOnly = true;
+5 -1
View File
@@ -1,4 +1,4 @@
{ config, options, lib, diskoLib, rootMountPoint, ... }:
{ config, options, lib, diskoLib, rootMountPoint, parent, ... }:
{
options = {
type = lib.mkOption {
@@ -25,6 +25,10 @@
type = lib.types.str;
description = "Format of the filesystem";
};
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+6 -2
View File
@@ -1,4 +1,4 @@
{ config, options, lib, diskoLib, ... }:
{ config, options, lib, diskoLib, parent, ... }:
{
options = {
type = lib.mkOption {
@@ -33,7 +33,11 @@
description = "Extra arguments to pass to `cryptsetup luksOpen` when opening";
example = [ "--allow-discards" ];
};
content = diskoLib.deviceType;
content = diskoLib.deviceType { parent = config; };
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+5 -1
View File
@@ -1,4 +1,4 @@
{ config, options, lib, diskoLib, ... }:
{ config, options, lib, diskoLib, parent, ... }:
{
options = {
type = lib.mkOption {
@@ -10,6 +10,10 @@
type = lib.types.str;
description = "Volume group";
};
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+1 -1
View File
@@ -33,7 +33,7 @@
default = [ ];
description = "Extra arguments";
};
content = diskoLib.partitionType;
content = diskoLib.partitionType { parent = config; };
};
}));
default = { };
+1 -1
View File
@@ -22,7 +22,7 @@
default = "default";
description = "Metadata";
};
content = diskoLib.deviceType;
content = diskoLib.deviceType { parent = config; };
_meta = lib.mkOption {
internal = true;
readOnly = true;
+5 -1
View File
@@ -1,4 +1,4 @@
{ config, options, lib, diskoLib, ... }:
{ config, options, lib, diskoLib, parent, ... }:
{
options = {
type = lib.mkOption {
@@ -11,6 +11,10 @@
type = lib.types.str;
description = "Name";
};
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+5 -1
View File
@@ -1,4 +1,4 @@
{ diskoLib, config, options, lib, ... }:
{ diskoLib, config, options, lib, parent, ... }:
{
options = {
type = lib.mkOption {
@@ -11,6 +11,10 @@
default = false;
description = "Whether to randomly encrypt the swap";
};
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+6 -2
View File
@@ -1,4 +1,4 @@
{ config, options, lib, diskoLib, ... }:
{ config, options, lib, diskoLib, parent, ... }:
{
options = {
type = lib.mkOption {
@@ -48,12 +48,16 @@
default = false;
description = "Whether to make the partition bootable";
};
content = diskoLib.partitionType;
content = diskoLib.partitionType { parent = config; };
};
}));
default = [ ];
description = "List of partitions to add to the partition table";
};
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+5 -1
View File
@@ -1,4 +1,4 @@
{ config, options, lib, diskoLib, ... }:
{ config, options, lib, diskoLib, parent, ... }:
{
options = {
type = lib.mkOption {
@@ -10,6 +10,10 @@
type = lib.types.str;
description = "Name of the ZFS pool";
};
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+5 -1
View File
@@ -1,4 +1,4 @@
{ config, options, lib, diskoLib, rootMountPoint, ... }:
{ config, options, lib, diskoLib, rootMountPoint, parent, ... }:
{
options = {
name = lib.mkOption {
@@ -29,6 +29,10 @@
description = "Path to mount the dataset to";
};
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+6 -2
View File
@@ -1,4 +1,4 @@
{ config, options, lib, diskoLib, ... }:
{ config, options, lib, diskoLib, parent, ... }:
{
options = {
name = lib.mkOption {
@@ -30,8 +30,12 @@
description = "Size of the dataset";
};
content = diskoLib.partitionType;
content = diskoLib.partitionType { parent = config; };
_parent = lib.mkOption {
internal = true;
default = parent;
};
_meta = lib.mkOption {
internal = true;
readOnly = true;
+4 -1
View File
@@ -49,7 +49,10 @@
'';
};
datasets = lib.mkOption {
type = lib.types.attrsOf (diskoLib.subType { inherit (diskoLib.types) zfs_fs zfs_volume; });
type = lib.types.attrsOf (diskoLib.subType {
types = { inherit (diskoLib.types) zfs_fs zfs_volume; };
extraArgs.parent = config;
});
description = "List of datasets to define";
};
_meta = lib.mkOption {