Skip to content

Commit 0bf7520

Browse files
MartinNikovPetarKirov
authored andcommitted
config(mcl-disko): Add option for swap randomEncryption
1 parent 58e29c3 commit 0bf7520

File tree

5 files changed

+35
-11
lines changed

5 files changed

+35
-11
lines changed

modules/mcl-disko/default.nix

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,20 @@
2929
description = "Declare the type of the primary partition";
3030
};
3131

32-
swapSize = mkOption {
33-
type = types.nullOr types.str;
34-
default = "32G";
35-
example = "32768M";
36-
description = "The size of the hard disk space used when RAM is full";
32+
swap = {
33+
size = mkOption {
34+
type = types.nullOr types.str;
35+
default = "32G";
36+
example = "32768M";
37+
description = "The size of the hard disk space used when RAM is full";
38+
};
39+
40+
randomEncryption = mkOption {
41+
type = types.bool;
42+
default = true;
43+
example = false;
44+
description = "Whether to use random encryption for swap partition";
45+
};
3746
};
3847

3948
espSize = mkOption {
@@ -162,9 +171,10 @@
162171
inherit disk lib;
163172
isSecondary = true;
164173
espSize = cfg.espSize;
165-
swapSize = cfg.swapSize;
174+
swapSize = cfg.swap.size;
166175
partitioningPreset = cfg.partitioningPreset;
167176
poolName = cfg.zpool.name;
177+
randomEncryption = cfg.swap.randomEncryption;
168178
}
169179
else
170180
makeSecondaryZfsDisk {
@@ -183,9 +193,10 @@
183193
disk = first;
184194
isSecondary = false;
185195
espSize = cfg.espSize;
186-
swapSize = cfg.swapSize;
196+
swapSize = cfg.swap.size;
187197
partitioningPreset = cfg.partitioningPreset;
188198
poolName = cfg.zpool.name;
199+
randomEncryption = cfg.swap.randomEncryption;
189200
};
190201
};
191202
zpool = import ./zpool.nix {

modules/mcl-disko/primaryPartition/default.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
swapSize,
77
partitioningPreset,
88
poolName,
9+
randomEncryption,
910
}:
1011
{
1112
type = "disk";
@@ -21,10 +22,18 @@
2122
espSize
2223
swapSize
2324
poolName
25+
randomEncryption
2426
;
2527
}
2628
else if partitioningPreset == "ext4" then
27-
import ./ext4.nix { inherit lib espSize swapSize; }
29+
import ./ext4.nix {
30+
inherit
31+
lib
32+
espSize
33+
swapSize
34+
randomEncryption
35+
;
36+
}
2837
else
2938
import ./zfs.nix {
3039
inherit
@@ -34,6 +43,7 @@
3443
espSize
3544
swapSize
3645
poolName
46+
randomEncryption
3747
;
3848
};
3949
}

modules/mcl-disko/primaryPartition/ext4.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
lib,
33
espSize,
44
swapSize,
5+
randomEncryption,
56
}:
67
{
78
ESP = {
@@ -33,7 +34,7 @@
3334
size = swapSize;
3435
content = {
3536
type = "swap";
36-
randomEncryption = true;
37+
inherit randomEncryption;
3738
};
3839
};
3940
}

modules/mcl-disko/primaryPartition/zfs-legacy-boot.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
espSize,
55
swapSize,
66
poolName,
7+
randomEncryption,
78
}:
89
[
910
{
@@ -43,7 +44,7 @@
4344
part-type = "primary";
4445
content = {
4546
type = "swap";
46-
randomEncryption = true;
47+
inherit randomEncryption;
4748
};
4849
}
4950
]

modules/mcl-disko/primaryPartition/zfs.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
espSize,
66
swapSize,
77
poolName,
8+
randomEncryption,
89
}:
910
{
1011
"ESP" = {
@@ -38,7 +39,7 @@
3839
size = swapSize;
3940
content = {
4041
type = "swap";
41-
randomEncryption = true;
42+
inherit randomEncryption;
4243
};
4344
};
4445
}

0 commit comments

Comments
 (0)