cluster/machines: move common LVM support bits into base.nix

Change-Id: I13e5653241a8245bae67cc7e660312484f1dcaca
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1767
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/cluster/machines/dcr01s22.hswaw.net.nix b/cluster/machines/dcr01s22.hswaw.net.nix
index d454516..a17e04c 100644
--- a/cluster/machines/dcr01s22.hswaw.net.nix
+++ b/cluster/machines/dcr01s22.hswaw.net.nix
@@ -10,15 +10,11 @@
   system.stateVersion = "19.09";
   nix.maxJobs = 48;
 
-  boot.initrd.kernelModules = [ "dm-raid" ];
 
   boot.loader.grub.device = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YJNX1M604518E";
   #fileSystems."/".device = "/dev/disk/by-uuid/b4149083-49fe-4951-a143-aff4cedaf33a";
   fileSystems."/".device = "/dev/vg-nixos-hscloud/nixos-root";
 
-  environment.etc."lvm/lvm.conf".text = ''
-    devices/issue_discards = 1
-  '';
 
   hscloud.base = {
     mgmtIf = "enp130s0f0";
diff --git a/cluster/machines/dcr03s16.hswaw.net.nix b/cluster/machines/dcr03s16.hswaw.net.nix
index 2264e64..f68838c 100644
--- a/cluster/machines/dcr03s16.hswaw.net.nix
+++ b/cluster/machines/dcr03s16.hswaw.net.nix
@@ -10,8 +10,6 @@
   system.stateVersion = "22.05";
   nix.maxJobs = 48;
 
-  boot.initrd.kernelModules = [ "dm-raid" ];
-
   fileSystems."/".device = "/dev/vg-nixos-hscloud/nixos-root";
   #services.lvm.enable = true;
   fileSystems."/boot1" =
@@ -34,9 +32,6 @@
       { devices = [ "nodev" ]; path = "/boot2"; efiSysMountPoint = "/boot2"; }
     ];
   };
-  environment.etc."lvm/lvm.conf".text = ''
-    devices/issue_discards = 1
-  '';
 
 
   hscloud.base = {
diff --git a/cluster/machines/modules/base.nix b/cluster/machines/modules/base.nix
index cc3a424..2a0a7ab 100644
--- a/cluster/machines/modules/base.nix
+++ b/cluster/machines/modules/base.nix
@@ -68,11 +68,16 @@
     boot.kernel.sysctl."net.ipv4.conf.all.rp_filter" = "0";
     boot.kernel.sysctl."net.ipv4.conf.default.rp_filter" = "0";
     boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "megaraid_sas" "usb_storage" "usbhid" "sd_mod" "sr_mod"  ];
+    boot.initrd.kernelModules = [ "dm-raid" "dm-snapshot" ];
     boot.kernelModules = [ "kvm-intel" ];
     boot.extraModulePackages = [];
     hardware.enableRedistributableFirmware = true;
     hardware.cpu.intel.updateMicrocode = true;
     hardware.cpu.amd.updateMicrocode = true;
+
+    environment.etc."lvm/lvm.conf".text = ''
+      devices/issue_discards = 1
+    '';
   
     time.timeZone = "Europe/Warsaw";