|
7 | 7 | }: |
8 | 8 | let |
9 | 9 | # Load kernel modules to ensure device mapper types are available |
10 | | - kernelModules = |
11 | | - [ |
12 | | - # Prevent unbootable systems if LVM snapshots are present at boot time. |
13 | | - "dm-snapshot" |
14 | | - ] |
15 | | - ++ lib.filter (x: x != "") ( |
16 | | - map (lv: lib.optionalString (lv.lvm_type != null && lv.lvm_type != "thinlv") "dm-${lv.lvm_type}") ( |
17 | | - lib.attrValues config.lvs |
18 | | - ) |
19 | | - ); |
| 10 | + kernelModules = [ |
| 11 | + # Prevent unbootable systems if LVM snapshots are present at boot time. |
| 12 | + "dm-snapshot" |
| 13 | + ] |
| 14 | + ++ lib.filter (x: x != "") ( |
| 15 | + map (lv: lib.optionalString (lv.lvm_type != null && lv.lvm_type != "thinlv") "dm-${lv.lvm_type}") ( |
| 16 | + lib.attrValues config.lvs |
| 17 | + ) |
| 18 | + ); |
20 | 19 | in |
21 | 20 | { |
22 | 21 | options = { |
|
182 | 181 | _config = lib.mkOption { |
183 | 182 | internal = true; |
184 | 183 | readOnly = true; |
185 | | - default = |
186 | | - [ { boot.initrd.kernelModules = kernelModules; } ] |
187 | | - ++ map (lv: [ |
188 | | - (lib.optional (lv.content != null) lv.content._config) |
189 | | - (lib.optional (lv.lvm_type != null) { |
190 | | - boot.initrd.kernelModules = |
191 | | - [ |
192 | | - (if lv.lvm_type == "mirror" then "dm-mirror" else "dm-raid") |
193 | | - ] |
194 | | - ++ lib.optional (lv.lvm_type == "raid0") "raid0" |
195 | | - ++ lib.optional (lv.lvm_type == "raid1") "raid1" |
196 | | - # ++ lib.optional (lv.lvm_type == "raid10") "raid10" |
197 | | - ++ lib.optional ( |
198 | | - lv.lvm_type == "raid4" || lv.lvm_type == "raid5" || lv.lvm_type == "raid6" |
199 | | - ) "raid456"; |
| 184 | + default = [ |
| 185 | + { boot.initrd.kernelModules = kernelModules; } |
| 186 | + ] |
| 187 | + ++ map (lv: [ |
| 188 | + (lib.optional (lv.content != null) lv.content._config) |
| 189 | + (lib.optional (lv.lvm_type != null) { |
| 190 | + boot.initrd.kernelModules = [ |
| 191 | + (if lv.lvm_type == "mirror" then "dm-mirror" else "dm-raid") |
| 192 | + ] |
| 193 | + ++ lib.optional (lv.lvm_type == "raid0") "raid0" |
| 194 | + ++ lib.optional (lv.lvm_type == "raid1") "raid1" |
| 195 | + # ++ lib.optional (lv.lvm_type == "raid10") "raid10" |
| 196 | + ++ lib.optional ( |
| 197 | + lv.lvm_type == "raid4" || lv.lvm_type == "raid5" || lv.lvm_type == "raid6" |
| 198 | + ) "raid456"; |
200 | 199 |
|
201 | | - }) |
202 | | - ]) (lib.attrValues config.lvs); |
| 200 | + }) |
| 201 | + ]) (lib.attrValues config.lvs); |
203 | 202 | description = "NixOS configuration"; |
204 | 203 | }; |
205 | 204 | _pkgs = lib.mkOption { |
|
0 commit comments