summary refs log tree commit diff
path: root/nixos/modules/installer/tools
diff options
context:
space:
mode:
authorDaniel Hill <daniel@gluo.nz>2023-09-23 15:34:38 +1200
committerJörg Thalheim <Mic92@users.noreply.github.com>2023-10-03 22:00:26 +0100
commitd6bf8b47ece5ed435cc0e66725fc7afe0ee1550b (patch)
tree87723c28aaead00514601bd2098240b870d1d341 /nixos/modules/installer/tools
parent6c1a24a6eaf0df82c06f2e5925dbf09fcf3d59c3 (diff)
downloadnixpkgs-d6bf8b47ece5ed435cc0e66725fc7afe0ee1550b.tar
nixpkgs-d6bf8b47ece5ed435cc0e66725fc7afe0ee1550b.tar.gz
nixpkgs-d6bf8b47ece5ed435cc0e66725fc7afe0ee1550b.tar.bz2
nixpkgs-d6bf8b47ece5ed435cc0e66725fc7afe0ee1550b.tar.lz
nixpkgs-d6bf8b47ece5ed435cc0e66725fc7afe0ee1550b.tar.xz
nixpkgs-d6bf8b47ece5ed435cc0e66725fc7afe0ee1550b.tar.zst
nixpkgs-d6bf8b47ece5ed435cc0e66725fc7afe0ee1550b.zip
bcachefs: 2023-06-28 -> 2023-09-29
Includes prep work for mainline bcachefs release.
Diffstat (limited to 'nixos/modules/installer/tools')
-rw-r--r--nixos/modules/installer/tools/nixos-generate-config.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index 7d0c5898e23..064d01d05c0 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -273,6 +273,7 @@ foreach my $path (glob "/sys/class/{block,mmc_host}/*") {
 
 # Add bcache module, if needed.
 my @bcacheDevices = glob("/dev/bcache*");
+@bcacheDevices = grep(!qr#dev/bcachefs.*#, @bcacheDevices);
 if (scalar @bcacheDevices > 0) {
     push @initrdAvailableKernelModules, "bcache";
 }
@@ -483,6 +484,19 @@ EOF
     # boot.tmp.useTmpfs option in configuration.nix (managed declaratively).
     next if ($mountPoint eq "/tmp" && $fsType eq "tmpfs");
 
+    # This should work for single and multi-device systems.
+    # still needs subvolume support
+    if ($fsType eq "bcachefs") {
+        my ($status, @info) = runCommand("bcachefs fs usage $rootDir$mountPoint");
+        my $UUID = $info[0];
+
+        if ($status == 0 && $UUID =~ /^Filesystem:[ \t\n]*([0-9a-z-]+)/) {
+            $stableDevPath = "UUID=$1";
+        } else {
+            print STDERR "warning: can't find bcachefs mount UUID falling back to device-path";
+        }
+    }
+
     # Emit the filesystem.
     $fileSystems .= <<EOF;
   fileSystems.\"$mountPoint\" =