98: Bcachefs r=Mic92 a=Mic92



Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
This commit is contained in:
bors[bot] 2023-01-04 09:00:20 +00:00 committed by GitHub
commit 07f6891b62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 5 deletions

28
bors.toml Normal file
View file

@ -0,0 +1,28 @@
cut_body_after = "" # don't include text from the PR body in the merge commit message
status = [
# garnix
"Evaluate flake.nix",
"package disko [x86_64-linux]",
"check boot-raid1 [x86_64-linux]",
"check bcachefs [x86_64-linux]",
"check luks-lvm [x86_64-linux]",
"check mdadm [x86_64-linux]",
"check lvm-luks-example-tsp-mount [x86_64-linux]",
"package default [x86_64-linux]",
"check lvm-luks-example-tsp-create [x86_64-linux]",
"check cli [x86_64-linux]",
"check btrfs-subvolumes [x86_64-linux]",
"check multi-device-no-deps [x86_64-linux]",
"check negative-size [x86_64-linux]",
"check swap [x86_64-linux]",
"check module [x86_64-linux]",
"check zfs [x86_64-linux]",
"check zfs-over-legacy [x86_64-linux]",
"check with-lib [x86_64-linux]",
"check complex [x86_64-linux]",
"check gpt-bios-compat [x86_64-linux]",
"check lvm-raid [x86_64-linux]",
"check standalone [x86_64-linux]",
"check tmpfs [x86_64-linux]",
"check simple-efi [x86_64-linux]"
]

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

@ -514,8 +514,9 @@ rec {
fs.${config.mountpoint} = ''
if ! findmnt ${dev} "/mnt${config.mountpoint}" > /dev/null 2>&1; then
mount ${dev} "/mnt${config.mountpoint}" \
${concatMapStringsSep " " (opt: "-o ${opt}") config.mountOptions} \
-o X-mount.mkdir
-t "${config.format}" \
${concatMapStringsSep " " (opt: "-o ${opt}") config.mountOptions} \
-o X-mount.mkdir
fi
'';
};
@ -544,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 []
);
};