nixos/systemd-stage-1: follow systemd /run propagation (#405687)

This commit is contained in:
Florian Klink 2025-05-29 12:21:50 +03:00 committed by GitHub
commit 2d03d70e9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 1 deletions

View file

@ -642,7 +642,7 @@ in
{
where = "/sysroot/run";
what = "/run";
options = "bind";
options = "rbind";
unitConfig = {
# See the comment on the mount unit for /run/etc-metadata
DefaultDependencies = false;

View file

@ -1302,6 +1302,7 @@ in
systemd-escaping = runTest ./systemd-escaping.nix;
systemd-initrd-bridge = runTest ./systemd-initrd-bridge.nix;
systemd-initrd-btrfs-raid = runTest ./systemd-initrd-btrfs-raid.nix;
systemd-initrd-credentials = runTest ./systemd-initrd-credentials.nix;
systemd-initrd-luks-fido2 = runTest ./systemd-initrd-luks-fido2.nix;
systemd-initrd-luks-keyfile = runTest ./systemd-initrd-luks-keyfile.nix;
systemd-initrd-luks-empty-passphrase = runTest {

View file

@ -0,0 +1,32 @@
{ lib, pkgs, ... }:
{
name = "systemd-initrd-credentials";
nodes.machine =
{ pkgs, ... }:
{
virtualisation = {
qemu.options = [
"-smbios type=11,value=io.systemd.credential:cred-smbios=secret-smbios"
];
};
boot.initrd.availableKernelModules = [ "dmi_sysfs" ];
boot.kernelParams = [ "systemd.set_credential=cred-cmdline:secret-cmdline" ];
boot.initrd.systemd = {
enable = true;
};
};
testScript = ''
machine.wait_for_unit("multi-user.target")
# Check credential passed via kernel command line
assert "secret-cmdline" in machine.succeed("systemd-creds --system cat cred-cmdline")
# Check credential passed via SMBIOS
assert "secret-smbios" in machine.succeed("systemd-creds --system cat cred-smbios")
'';
}