summary refs log tree commit diff
path: root/nixos/modules/tasks/filesystems/btrfs.nix
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2023-10-19 21:09:12 -0400
committerWill Fancher <elvishjerricco@gmail.com>2023-10-19 21:13:22 -0400
commit18013cc71e8d00cc1297af29d519b420f1326b41 (patch)
treeecba139657289a779be853f035aadb3f9abfb0b4 /nixos/modules/tasks/filesystems/btrfs.nix
parentca012a02bf8327be9e488546faecae5e05d7d749 (diff)
downloadnixpkgs-18013cc71e8d00cc1297af29d519b420f1326b41.tar
nixpkgs-18013cc71e8d00cc1297af29d519b420f1326b41.tar.gz
nixpkgs-18013cc71e8d00cc1297af29d519b420f1326b41.tar.bz2
nixpkgs-18013cc71e8d00cc1297af29d519b420f1326b41.tar.lz
nixpkgs-18013cc71e8d00cc1297af29d519b420f1326b41.tar.xz
nixpkgs-18013cc71e8d00cc1297af29d519b420f1326b41.tar.zst
nixpkgs-18013cc71e8d00cc1297af29d519b420f1326b41.zip
systemd-stage-1: Use specific fs packages
Diffstat (limited to 'nixos/modules/tasks/filesystems/btrfs.nix')
-rw-r--r--nixos/modules/tasks/filesystems/btrfs.nix17
1 files changed, 10 insertions, 7 deletions
diff --git a/nixos/modules/tasks/filesystems/btrfs.nix b/nixos/modules/tasks/filesystems/btrfs.nix
index 82fdd605871..87fe326c097 100644
--- a/nixos/modules/tasks/filesystems/btrfs.nix
+++ b/nixos/modules/tasks/filesystems/btrfs.nix
@@ -52,34 +52,37 @@ in
   config = mkMerge [
     (mkIf enableBtrfs {
       system.fsPackages = [ pkgs.btrfs-progs ];
+    })
 
-      boot.initrd.kernelModules = mkIf inInitrd [ "btrfs" ];
-      boot.initrd.availableKernelModules = mkIf inInitrd (
+    (mkIf inInitrd {
+      boot.initrd.kernelModules = [ "btrfs" ];
+      boot.initrd.availableKernelModules =
         [ "crc32c" ]
         ++ optionals (config.boot.kernelPackages.kernel.kernelAtLeast "5.5") [
           # Needed for mounting filesystems with new checksums
           "xxhash_generic"
           "blake2b_generic"
           "sha256_generic" # Should be baked into our kernel, just to be sure
-        ]
-      );
+        ];
 
-      boot.initrd.extraUtilsCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable)
+      boot.initrd.extraUtilsCommands = mkIf (!config.boot.initrd.systemd.enable)
       ''
         copy_bin_and_libs ${pkgs.btrfs-progs}/bin/btrfs
         ln -sv btrfs $out/bin/btrfsck
         ln -sv btrfsck $out/bin/fsck.btrfs
       '';
 
-      boot.initrd.extraUtilsCommandsTest = mkIf (inInitrd && !config.boot.initrd.systemd.enable)
+      boot.initrd.extraUtilsCommandsTest = mkIf (!config.boot.initrd.systemd.enable)
       ''
         $out/bin/btrfs --version
       '';
 
-      boot.initrd.postDeviceCommands = mkIf (inInitrd && !config.boot.initrd.systemd.enable)
+      boot.initrd.postDeviceCommands = mkIf (!config.boot.initrd.systemd.enable)
       ''
         btrfs device scan
       '';
+
+      boot.initrd.systemd.initrdBin = [ pkgs.btrfs-progs ];
     })
 
     (mkIf enableAutoScrub {