mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 15:13:46 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
46 lines
1.5 KiB
Nix
46 lines
1.5 KiB
Nix
import ./make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
{
|
|
name = "systemd-cryptenroll";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [ ymatsiuk ];
|
|
};
|
|
|
|
nodes.machine =
|
|
{ pkgs, lib, ... }:
|
|
{
|
|
environment.systemPackages = [ pkgs.cryptsetup ];
|
|
virtualisation = {
|
|
emptyDiskImages = [ 512 ];
|
|
tpm.enable = true;
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
machine.start()
|
|
|
|
# Verify the TPM device is available and accessible by systemd-cryptenroll
|
|
machine.succeed("test -e /dev/tpm0")
|
|
machine.succeed("test -e /dev/tpmrm0")
|
|
machine.succeed("systemd-cryptenroll --tpm2-device=list")
|
|
|
|
# Create LUKS partition
|
|
machine.succeed("echo -n lukspass | cryptsetup luksFormat -q /dev/vdb -")
|
|
# Enroll new LUKS key and bind it to Secure Boot state
|
|
# For more details on PASSWORD variable, check the following issue:
|
|
# https://github.com/systemd/systemd/issues/20955
|
|
machine.succeed("PASSWORD=lukspass systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=7 /dev/vdb")
|
|
# Add LUKS partition to /etc/crypttab to test auto unlock
|
|
machine.succeed("echo 'luks /dev/vdb - tpm2-device=auto' >> /etc/crypttab")
|
|
|
|
machine.shutdown()
|
|
machine.start()
|
|
|
|
# Test LUKS partition automatic unlock on boot
|
|
machine.wait_for_unit("systemd-cryptsetup@luks.service")
|
|
# Wipe TPM2 slot
|
|
machine.succeed("systemd-cryptenroll --wipe-slot=tpm2 /dev/vdb")
|
|
'';
|
|
}
|
|
)
|