summary refs log tree commit diff
diff options
context:
space:
mode:
authorajs124 <git@ajs124.de>2021-08-05 15:39:18 +0200
committerajs124 <git@ajs124.de>2021-08-20 12:55:06 +0200
commitf358f7326b811d1ad0694187b4ece53f8e56576e (patch)
treec25252c243215c049587af5bcfc3f2b4b1c7ca51
parent14b0f20fa1f56438b74100513c9b1f7c072cf789 (diff)
downloadnixpkgs-f358f7326b811d1ad0694187b4ece53f8e56576e.tar
nixpkgs-f358f7326b811d1ad0694187b4ece53f8e56576e.tar.gz
nixpkgs-f358f7326b811d1ad0694187b4ece53f8e56576e.tar.bz2
nixpkgs-f358f7326b811d1ad0694187b4ece53f8e56576e.tar.lz
nixpkgs-f358f7326b811d1ad0694187b4ece53f8e56576e.tar.xz
nixpkgs-f358f7326b811d1ad0694187b4ece53f8e56576e.tar.zst
nixpkgs-f358f7326b811d1ad0694187b4ece53f8e56576e.zip
tasks/lvm: add all tools from thin-provisioning-tools
This should barely increase the size of the initrd, because these are all symlinks.
With this, systems with dm-cache/lvmcache can also be booted, although the kernel modules for the relevant dm targets still need to be added to the initrd with boot.initrd.kernelModules.
-rw-r--r--nixos/modules/tasks/lvm.nix26
1 files changed, 18 insertions, 8 deletions
diff --git a/nixos/modules/tasks/lvm.nix b/nixos/modules/tasks/lvm.nix
index 98a0e2ddef9..aaa76b49fa3 100644
--- a/nixos/modules/tasks/lvm.nix
+++ b/nixos/modules/tasks/lvm.nix
@@ -46,22 +46,32 @@ in {
         kernelModules = [ "dm-snapshot" "dm-thin-pool" ];
 
         extraUtilsCommands = ''
-          copy_bin_and_libs ${pkgs.thin-provisioning-tools}/bin/pdata_tools
-          copy_bin_and_libs ${pkgs.thin-provisioning-tools}/bin/thin_check
+          for BIN in ${pkgs.thin-provisioning-tools}/bin/*; do
+            copy_bin_and_libs $BIN
+          done
+        '';
+
+        extraUtilsCommandsTest = ''
+          ls ${pkgs.thin-provisioning-tools}/bin/ | grep -v pdata_tools | while read BIN; do
+            $out/bin/$(basename $BIN) --help > /dev/null
+          done
         '';
       };
 
-      environment.etc."lvm/lvm.conf".text = ''
-        global/thin_check_executable = "${pkgs.thin-provisioning-tools}/bin/thin_check"
-      '';
+      environment.etc."lvm/lvm.conf".text = concatMapStringsSep "\n"
+        (bin: "global/${bin}_executable = ${pkgs.thin-provisioning-tools}/bin/${bin}")
+        [ "thin_check" "thin_dump" "thin_repair" "cache_check" "cache_dump" "cache_repair" ];
     })
     (mkIf (cfg.dmeventd.enable || cfg.boot.thin.enable) {
       boot.initrd.preLVMCommands = ''
           mkdir -p /etc/lvm
           cat << EOF >> /etc/lvm/lvm.conf
-          ${optionalString cfg.boot.thin.enable ''
-            global/thin_check_executable = "$(command -v thin_check)"
-          ''}
+          ${optionalString cfg.boot.thin.enable (
+            concatMapStringsSep "\n"
+              (bin: "global/${bin}_executable = $(command -v ${bin})")
+              [ "thin_check" "thin_dump" "thin_repair" "cache_check" "cache_dump" "cache_repair" ]
+            )
+          }
           ${optionalString cfg.dmeventd.enable ''
             dmeventd/executable = "$(command -v false)"
             activation/monitoring = 0