nix: Test module

This commit is contained in:
Will Fancher 2025-09-27 04:06:37 -04:00
parent d3ced65a68
commit 252a37e2cb
2 changed files with 36 additions and 0 deletions

View File

@ -135,6 +135,8 @@
pname = "${prev.pname}-msrv";
}
);
nixos-test = pkgs.nixosTest (import ./nixos-test.nix self');
};
devShells.default = pkgs.mkShell {

34
nixos-test.nix Normal file
View File

@ -0,0 +1,34 @@
self': {
name = "bcachefs-nixos";
nodes.machine =
{ config, ... }:
{
assertions = [
{
assertion =
config.boot.bcachefs.modulePackage or null == self'.packages.bcachefs-module-linux-latest;
message = "Local bcachefs module isn't being used; update nixpkgs?";
}
];
virtualisation.emptyDiskImages = [
{
size = 4096;
driveConfig.deviceExtraOpts.serial = "test-disk";
}
];
boot.supportedFilesystems.bcachefs = true;
boot.bcachefs.package = self'.packages.bcachefs-tools;
};
testScript = ''
machine.succeed(
"modinfo bcachefs | grep updates/src/fs/bcachefs > /dev/null",
"mkfs.bcachefs /dev/disk/by-id/virtio-test-disk",
"mkdir /mnt",
"mount /dev/disk/by-id/virtio-test-disk /mnt",
)
'';
}