Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions modules/mcl-disko/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@
description = "Declare the type of the primary partition";
};

swapSize = mkOption {
type = types.nullOr types.str;
default = "32G";
example = "32768M";
description = "The size of the hard disk space used when RAM is full";
swap = {
size = mkOption {
type = types.nullOr types.str;
default = "32G";
example = "32768M";
description = "The size of the hard disk space used when RAM is full";
};

randomEncryption = mkOption {
type = types.bool;
default = true;
example = false;
description = "Whether to use random encryption for swap partition";
};
};

espSize = mkOption {
Expand Down Expand Up @@ -162,9 +171,10 @@
inherit disk lib;
isSecondary = true;
espSize = cfg.espSize;
swapSize = cfg.swapSize;
swapSize = cfg.swap.size;
partitioningPreset = cfg.partitioningPreset;
poolName = cfg.zpool.name;
randomEncryption = cfg.swap.randomEncryption;
}
else
makeSecondaryZfsDisk {
Expand All @@ -183,9 +193,10 @@
disk = first;
isSecondary = false;
espSize = cfg.espSize;
swapSize = cfg.swapSize;
swapSize = cfg.swap.size;
partitioningPreset = cfg.partitioningPreset;
poolName = cfg.zpool.name;
randomEncryption = cfg.swap.randomEncryption;
};
};
zpool = import ./zpool.nix {
Expand Down
12 changes: 11 additions & 1 deletion modules/mcl-disko/primaryPartition/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
swapSize,
partitioningPreset,
poolName,
randomEncryption,
}:
{
type = "disk";
Expand All @@ -21,10 +22,18 @@
espSize
swapSize
poolName
randomEncryption
;
}
else if partitioningPreset == "ext4" then
import ./ext4.nix { inherit lib espSize swapSize; }
import ./ext4.nix {
inherit
lib
espSize
swapSize
randomEncryption
;
}
else
import ./zfs.nix {
inherit
Expand All @@ -34,6 +43,7 @@
espSize
swapSize
poolName
randomEncryption
;
};
}
Expand Down
3 changes: 2 additions & 1 deletion modules/mcl-disko/primaryPartition/ext4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
espSize,
swapSize,
randomEncryption,
}:
{
ESP = {
Expand Down Expand Up @@ -33,7 +34,7 @@
size = swapSize;
content = {
type = "swap";
randomEncryption = true;
inherit randomEncryption;
};
};
}
3 changes: 2 additions & 1 deletion modules/mcl-disko/primaryPartition/zfs-legacy-boot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
espSize,
swapSize,
poolName,
randomEncryption,
}:
[
{
Expand Down Expand Up @@ -43,7 +44,7 @@
part-type = "primary";
content = {
type = "swap";
randomEncryption = true;
inherit randomEncryption;
};
}
]
3 changes: 2 additions & 1 deletion modules/mcl-disko/primaryPartition/zfs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
espSize,
swapSize,
poolName,
randomEncryption,
}:
{
"ESP" = {
Expand Down Expand Up @@ -38,7 +39,7 @@
size = swapSize;
content = {
type = "swap";
randomEncryption = true;
inherit randomEncryption;
};
};
}