bcachefs support

This commit is contained in:
Jörg Thalheim 2022-12-29 18:46:31 +01:00
parent cb5748f03a
commit eca7cb9132
4 changed files with 61 additions and 3 deletions

39
example/bcachefs.nix Normal file
View file

@ -0,0 +1,39 @@
{ disks ? [ "/dev/vdb" ], ... }: {
disk = {
vdb = {
device = builtins.elemAt disks 0;
type = "disk";
content = {
type = "table";
format = "gpt";
partitions = [
{
type = "partition";
name = "ESP";
start = "1MiB";
end = "100MiB";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
}
{
name = "root";
type = "partition";
start = "100MiB";
end = "100%";
part-type = "primary";
content = {
type = "filesystem";
format = "bcachefs";
mountpoint = "/";
};
}
];
};
};
};
}

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1671788672,
"narHash": "sha256-tLkPxJuos3jki2f/TZdHn+NuMQAzN9s2E4QudylQLg0=",
"lastModified": 1672756850,
"narHash": "sha256-Smbq3+fitwA13qsTMeaaurv09/KVbZfW7m7lINwzDGA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2c74fcd6c5fc14a61de158fb796243543f46b217",
"rev": "298add347c2bbce14020fcb54051f517c391196b",
"type": "github"
},
"original": {

18
tests/bcachefs.nix Normal file
View file

@ -0,0 +1,18 @@
{ pkgs ? (import <nixpkgs> { })
, makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest
}:
makeDiskoTest {
disko-config = ../example/bcachefs.nix;
extraTestScript = ''
machine.succeed("mountpoint /");
machine.succeed("lsblk >&2");
'';
# so that the installer boots with a bcachefs enabled kernel
extraConfig = {
boot.supportedFilesystems = [ "bcachefs" ];
# disable zfs so we can support latest kernel
nixpkgs.overlays = [(final: super: {
zfs = super.zfs.overrideAttrs(_: {meta.platforms = [];});}
)];
};
}

View file

@ -545,6 +545,7 @@ rec {
else if (config.format == "ext2") then [ pkgs.e2fsprogs ]
else if (config.format == "ext3") then [ pkgs.e2fsprogs ]
else if (config.format == "ext4") then [ pkgs.e2fsprogs ]
else if (config.format == "bcachefs") then [ pkgs.bcachefs-tools ]
else []
);
};