Created
May 31, 2022 07:26
-
-
Save Madouura/647fa43c65d2ed77125d8a8cec73a7bc to your computer and use it in GitHub Desktop.
nixpkgs installer.nix bcachefsEncrypted test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bcachefsEncrypted = makeInstallerTest "bcachefs-encrypted" { | |
extraInstallerConfig = { | |
boot.supportedFilesystems = [ "bcachefs" ]; | |
environment.systemPackages = with pkgs; [ keyutils ]; | |
}; | |
# We don't want to use the normal way of unlocking bcachefs defined in tasks/filesystems/bcachefs.nix. | |
# So, override initrd.postDeviceCommands completely and simply unlock with the predefined password. | |
extraConfig = '' | |
boot.initrd.postDeviceCommands = lib.mkForce "echo password | bcachefs unlock /dev/vda3"; | |
''; | |
createPartitions = '' | |
machine.succeed( | |
"flock /dev/vda parted --script /dev/vda -- mklabel msdos" | |
+ " mkpart primary ext2 1M 100MB" # /boot | |
+ " mkpart primary linux-swap 100M 1024M" # swap | |
+ " mkpart primary 1024M -1s", # / | |
"udevadm settle", | |
"mkswap /dev/vda2 -L swap", | |
"swapon -L swap", | |
"keyctl link @u @s", | |
"echo password | mkfs.bcachefs -L root --encrypted /dev/vda3", | |
"echo password | bcachefs unlock /dev/vda3", | |
"mount -t bcachefs /dev/vda3 /mnt", | |
"mkfs.ext3 -L boot /dev/vda1", | |
"mkdir -p /mnt/boot", | |
"mount /dev/vda1 /mnt/boot", | |
"bcachefs fs usage /mnt >&2", | |
"bcachefs show-super /dev/vda3 >&2", | |
) | |
''; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment