Skip to content

Commit 2c3ac40

Browse files
Mic92mergify[bot]
authored andcommitted
get rid of lib.uniq
1 parent 6eb1340 commit 2c3ac40

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

modules/nixos/boot.nix

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ let
33

44
cfg = config.facter.boot;
55
inherit (config.facter) report;
6+
collectDriver = list: lib.foldl' (lst: value: lst ++ value.driver_modules or [ ]) [ ] list;
7+
stringSet = list: builtins.attrNames (builtins.groupBy lib.id list);
68
in
79
{
810
options.facter.boot.enable = lib.mkEnableOption "Enable the Facter Boot module" // {
@@ -12,25 +14,15 @@ in
1214
config =
1315
with lib;
1416
mkIf cfg.enable {
15-
boot.initrd.availableKernelModules = filter (dm: dm != null) (
16-
unique (
17-
map
18-
(
19-
{
20-
driver_module ? null,
21-
...
22-
}:
23-
driver_module
24-
)
25-
(flatten [
26-
# Needed if we want to use the keyboard when things go wrong in the initrd.
27-
(report.hardware.usb_controller or [ ])
28-
# A disk might be attached.
29-
(report.hardware.firewire_controller or [ ])
30-
# definitely important
31-
(report.hardware.disk or [ ])
32-
(report.hardware.storage_controller or [ ])
33-
])
17+
boot.initrd.availableKernelModules = stringSet (
18+
collectDriver (
19+
# Needed if we want to use the keyboard when things go wrong in the initrd.
20+
(report.hardware.usb_controller or [ ])
21+
# A disk might be attached.
22+
++ (report.hardware.firewire_controller or [ ])
23+
# definitely important
24+
++ (report.hardware.disk or [ ])
25+
++ (report.hardware.storage_controller or [ ])
3426
)
3527
);
3628
};

0 commit comments

Comments
 (0)