mirror of
https://github.com/nix-community/disko
synced 2024-11-10 06:14:14 +00:00
swap: don't activate random encrypted swap files
This requires more code and is not implemented just now.
This commit is contained in:
parent
2d7d77878c
commit
3cb78c93e6
3 changed files with 14 additions and 13 deletions
|
@ -24,11 +24,17 @@
|
|||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "100%";
|
||||
encryptedSwap = {
|
||||
size = "10M";
|
||||
content = {
|
||||
type = "swap";
|
||||
randomEncryption = true;
|
||||
};
|
||||
};
|
||||
plainSwap = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "swap";
|
||||
resumeDevice = true; # resume from hiberation from this device
|
||||
};
|
||||
};
|
||||
|
@ -38,4 +44,3 @@
|
|||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@
|
|||
};
|
||||
_mount = diskoLib.mkMountOption {
|
||||
inherit config options;
|
||||
default = {
|
||||
# TODO: we don't support encrypted swap yet
|
||||
default = lib.optionalAttrs (!config.randomEncryption) {
|
||||
fs.${config.device} = ''
|
||||
if ! swapon --show | grep -q "^$(readlink -f ${config.device}) "; then
|
||||
swapon ${config.device}
|
||||
|
|
|
@ -6,17 +6,12 @@ diskoLib.testLib.makeDiskoTest {
|
|||
name = "swap";
|
||||
disko-config = ../example/swap.nix;
|
||||
extraTestScript = ''
|
||||
import json
|
||||
machine.succeed("mountpoint /");
|
||||
machine.succeed("swapon --show >&2");
|
||||
machine.succeed("""
|
||||
lsblk --json |
|
||||
jq -e '.blockdevices[] |
|
||||
select(.name == "vda") |
|
||||
.children[] |
|
||||
select(.name == "vda3") |
|
||||
.children[0].mountpoints[0] == "[SWAP]"
|
||||
'
|
||||
""");
|
||||
out = json.loads(machine.succeed("lsblk --json /dev/vda"))
|
||||
mnt_point = out["blockdevices"][0]["children"][1]["children"][0]["mountpoints"][0]
|
||||
assert mnt_point == "[SWAP]"
|
||||
'';
|
||||
extraSystemConfig = {
|
||||
environment.systemPackages = [ pkgs.jq ];
|
||||
|
|
Loading…
Reference in a new issue