From 0003a08b78b16ccfaff86a763e1870f6c6f55d15 Mon Sep 17 00:00:00 2001 From: beviu Date: Wed, 15 Apr 2026 17:46:46 +0200 Subject: [PATCH 1/2] nixos/bcachefs: add sbin/bcachefs to the Systemd initrd's storePaths A later commit will add the bcachefs-wait-devices@.service unit to the initrd. Since it references sbin/bcachefs, so we need to add it to the initrd. Note that sbin/bcachefs is just a symlink to the actual executable in bin so nothing is duplicated. --- nixos/modules/tasks/filesystems/bcachefs.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nixos/modules/tasks/filesystems/bcachefs.nix b/nixos/modules/tasks/filesystems/bcachefs.nix index 481773991206..7dfa2f2f62c8 100644 --- a/nixos/modules/tasks/filesystems/bcachefs.nix +++ b/nixos/modules/tasks/filesystems/bcachefs.nix @@ -273,6 +273,10 @@ in "bcachefs" = "${cfg.package}/bin/bcachefs"; "mount.bcachefs" = "${cfg.package}/bin/mount.bcachefs"; }; + boot.initrd.systemd.storePaths = [ + # Used by the ExecStart= in bcachefs-wait-devices@.service. + "${cfg.package}/sbin/bcachefs" + ]; boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable) '' copy_bin_and_libs ${cfg.package}/bin/bcachefs copy_bin_and_libs ${cfg.package}/bin/mount.bcachefs From 04beb061642a720e1de097678e0add14b40aa4a0 Mon Sep 17 00:00:00 2001 From: beviu Date: Wed, 15 Apr 2026 17:46:46 +0200 Subject: [PATCH 2/2] nixos/bcachefs: add upstream Systemd units to initrd The bcachefs-wait-devices@.service unit can be added as a Wants dependency to a .mount units to wait until every device in the filesystem is initialized before doing the mount. --- nixos/modules/tasks/filesystems/bcachefs.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/tasks/filesystems/bcachefs.nix b/nixos/modules/tasks/filesystems/bcachefs.nix index 7dfa2f2f62c8..bb338bc992c9 100644 --- a/nixos/modules/tasks/filesystems/bcachefs.nix +++ b/nixos/modules/tasks/filesystems/bcachefs.nix @@ -289,6 +289,7 @@ in commonFunctions + lib.concatStrings (lib.mapAttrsToList openCommand bootFs) ); + boot.initrd.systemd.packages = [ cfg.package ]; boot.initrd.systemd.services = lib.mapAttrs' (mkUnits "/sysroot") bootFs; })