forked from mirrors/nixpkgs
Merge pull request #208257 from Mic92/bcachefs
bcachefs-tools: add symlink for mount.bcachefs and fix runtime deps
This commit is contained in:
commit
c23025886d
|
@ -42,7 +42,11 @@ in
|
|||
{
|
||||
config = mkIf (elem "bcachefs" config.boot.supportedFilesystems) (mkMerge [
|
||||
{
|
||||
system.fsPackages = [ pkgs.bcachefs-tools ];
|
||||
# We do not want to include bachefs in the fsPackages for systemd-initrd
|
||||
# because we provide the unwrapped version of mount.bcachefs
|
||||
# through the extraBin option, which will make it available for use.
|
||||
system.fsPackages = lib.optional (!config.boot.initrd.systemd.enable) pkgs.bcachefs-tools;
|
||||
environment.systemPackages = lib.optional (config.boot.initrd.systemd.enable) pkgs.bcachefs-tools;
|
||||
|
||||
# use kernel package with bcachefs support until it's in mainline
|
||||
boot.kernelPackages = pkgs.linuxPackages_testing_bcachefs;
|
||||
|
@ -52,7 +56,14 @@ in
|
|||
# chacha20 and poly1305 are required only for decryption attempts
|
||||
boot.initrd.availableKernelModules = [ "bcachefs" "sha256" "chacha20" "poly1305" ];
|
||||
|
||||
boot.initrd.extraUtilsCommands = ''
|
||||
boot.initrd.systemd.extraBin = {
|
||||
"bcachefs" = "${pkgs.bcachefs-tools}/bin/bcachefs";
|
||||
"mount.bcachefs" = pkgs.runCommand "mount.bcachefs" {} ''
|
||||
cp -pdv ${pkgs.bcachefs-tools}/bin/.mount.bcachefs.sh-wrapped $out
|
||||
'';
|
||||
};
|
||||
|
||||
boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
|
||||
copy_bin_and_libs ${pkgs.bcachefs-tools}/bin/bcachefs
|
||||
'';
|
||||
boot.initrd.extraUtilsCommandsTest = ''
|
||||
|
|
|
@ -465,8 +465,12 @@ let
|
|||
'';
|
||||
testSpecialisationConfig = true;
|
||||
};
|
||||
|
||||
|
||||
# disable zfs so we can support latest kernel if needed
|
||||
no-zfs-module = {
|
||||
nixpkgs.overlays = [(final: super: {
|
||||
zfs = super.zfs.overrideAttrs(_: {meta.platforms = [];});}
|
||||
)];
|
||||
};
|
||||
in {
|
||||
|
||||
# !!! `parted mkpart' seems to silently create overlapping partitions.
|
||||
|
@ -714,6 +718,7 @@ in {
|
|||
bcachefsSimple = makeInstallerTest "bcachefs-simple" {
|
||||
extraInstallerConfig = {
|
||||
boot.supportedFilesystems = [ "bcachefs" ];
|
||||
imports = [ no-zfs-module ];
|
||||
};
|
||||
|
||||
createPartitions = ''
|
||||
|
@ -737,13 +742,22 @@ in {
|
|||
bcachefsEncrypted = makeInstallerTest "bcachefs-encrypted" {
|
||||
extraInstallerConfig = {
|
||||
boot.supportedFilesystems = [ "bcachefs" ];
|
||||
|
||||
# disable zfs so we can support latest kernel if needed
|
||||
imports = [ no-zfs-module ];
|
||||
|
||||
environment.systemPackages = with pkgs; [ keyutils ];
|
||||
};
|
||||
|
||||
# We don't want to use the normal way of unlocking bcachefs defined in tasks/filesystems/bcachefs.nix.
|
||||
# So, override initrd.postDeviceCommands completely and simply unlock with the predefined password.
|
||||
extraConfig = ''
|
||||
boot.initrd.postDeviceCommands = lib.mkForce "echo password | bcachefs unlock /dev/vda3";
|
||||
boot.kernelParams = lib.mkAfter [ "console=tty0" ];
|
||||
'';
|
||||
|
||||
enableOCR = true;
|
||||
preBootCommands = ''
|
||||
machine.start()
|
||||
machine.wait_for_text("enter passphrase for ")
|
||||
machine.send_chars("password\n")
|
||||
'';
|
||||
|
||||
createPartitions = ''
|
||||
|
@ -769,6 +783,9 @@ in {
|
|||
bcachefsMulti = makeInstallerTest "bcachefs-multi" {
|
||||
extraInstallerConfig = {
|
||||
boot.supportedFilesystems = [ "bcachefs" ];
|
||||
|
||||
# disable zfs so we can support latest kernel if needed
|
||||
imports = [ no-zfs-module ];
|
||||
};
|
||||
|
||||
createPartitions = ''
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{ lib
|
||||
, fetchpatch
|
||||
, kernel
|
||||
, commitDate ? "2022-10-31"
|
||||
, currentCommit ? "77c27f28aa58e9d9037eb68c87d3283f68c371f7"
|
||||
, diffHash ? "sha256-TUpI9z0ac3rjn2oT5Z7oQXevDKbGwTVjyigS5/aGwgQ="
|
||||
, commitDate ? "2022-12-29"
|
||||
, currentCommit ? "8f064a4cb5c7cce289b83d7a459e6d8620188b37"
|
||||
, diffHash ? "sha256-RnlM7uOSWhFHG1aj5BOjrfRtoZfbx+tqQw1V49nW5vw="
|
||||
|
||||
, kernelPatches # must always be defined in bcachefs' all-packages.nix entry because it's also a top-level attribute supplied by callPackage
|
||||
, argsOverride ? {}
|
||||
, ...
|
||||
|
|
|
@ -13,22 +13,25 @@
|
|||
, zstd
|
||||
, lz4
|
||||
, python3Packages
|
||||
, util-linux
|
||||
, udev
|
||||
, valgrind
|
||||
, nixosTests
|
||||
, makeWrapper
|
||||
, getopt
|
||||
, fuse3
|
||||
, fuseSupport ? false
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "bcachefs-tools";
|
||||
version = "unstable-2022-09-28";
|
||||
version = "unstable-2022-12-29";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "koverstreet";
|
||||
repo = "bcachefs-tools";
|
||||
rev = "99caca2c70f312c4a2504a7e7a9c92a91426d885";
|
||||
sha256 = "sha256-9bFTBFkQq8SvhYa9K4+MH2zvKZviNaq0sFWoeGgch7g=";
|
||||
rev = "42cf74fd1d0ef58927967e6236988e86cfc0d086";
|
||||
sha256 = "sha256-N/1heStwmB7CzE/ddTud/ywnMdhq8ZkLju+x0UL0yjY=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
|
@ -39,7 +42,9 @@ stdenv.mkDerivation {
|
|||
"INITRAMFS_DIR=${placeholder "out"}/etc/initramfs-tools"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkg-config docutils python3Packages.python ];
|
||||
nativeBuildInputs = [
|
||||
pkg-config docutils python3Packages.python makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libuuid libscrypt libsodium keyutils liburcu zlib libaio
|
||||
|
@ -54,6 +59,13 @@ stdenv.mkDerivation {
|
|||
rm tests/test_fuse.py
|
||||
'';
|
||||
|
||||
# this symlink is needed for mount -t bcachefs to work
|
||||
postFixup = ''
|
||||
ln -s $out/bin/mount.bcachefs.sh $out/bin/mount.bcachefs
|
||||
wrapProgram $out/bin/mount.bcachefs.sh \
|
||||
--prefix PATH : ${lib.makeBinPath [ getopt util-linux ]}
|
||||
'';
|
||||
|
||||
installFlags = [ "PREFIX=${placeholder "out"}" ];
|
||||
|
||||
passthru.tests = {
|
||||
|
|
|
@ -184,7 +184,7 @@ in {
|
|||
else testing;
|
||||
|
||||
linux_testing_bcachefs = callPackage ../os-specific/linux/kernel/linux-testing-bcachefs.nix rec {
|
||||
kernel = linux_6_0;
|
||||
kernel = linux_6_1;
|
||||
kernelPatches = kernel.kernelPatches;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue