Skip to content

Commit 1c952b3

Browse files
committed
format, and add comment for unsafe call
1 parent 62c4eef commit 1c952b3

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

lenovo/thinkpad/x13s/default.nix

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,28 @@ in
204204

205205
# grub does not handle device tree yet
206206
(lib.mkIf (config.boot.loader.grub.enable) {
207-
warnings = lib.optional (!config.boot.loader.grub.efiSupport) "grub.efiSupport is required for Lenovo Thinkpad x13s";
207+
warnings = lib.optional (
208+
!config.boot.loader.grub.efiSupport
209+
) "grub.efiSupport is required for Lenovo Thinkpad x13s";
208210
boot = {
209211
loader.grub = {
210212
extraPerEntryConfig = ''
211213
devicetree dtbs/${deviceTree.kernelPackage.version}/${deviceTree.name}
212214
'';
213-
extraFiles = let
214-
deviceTrees = lib.map (lib.removePrefix "${deviceTree.package}/") (lib.filesystem.listFilesRecursive "${deviceTree.package}");
215-
in lib.listToAttrs (lib.map (dt: {
216-
name = builtins.unsafeDiscardStringContext "dtbs/${deviceTree.kernelPackage.version}/${dt}";
217-
value = "${deviceTree.package}/${dt}";
218-
}) deviceTrees);
215+
extraFiles =
216+
let
217+
deviceTrees = lib.map (lib.removePrefix "${deviceTree.package}/") (
218+
lib.filesystem.listFilesRecursive "${deviceTree.package}"
219+
);
220+
in
221+
lib.listToAttrs (
222+
lib.map (dt: {
223+
# It's alright to throw away the context here. We still have context through the value
224+
# and the context is not needed to generate paths based on filenames in the device tree
225+
name = builtins.unsafeDiscardStringContext "dtbs/${deviceTree.kernelPackage.version}/${dt}";
226+
value = "${deviceTree.package}/${dt}";
227+
}) deviceTrees
228+
);
219229
};
220230
};
221231
})

0 commit comments

Comments
 (0)