summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-06-21 10:33:09 +0200
committerFlorian Klink <flokli@flokli.de>2020-06-21 13:48:22 +0200
commit387f3b58d2cfe131700a3c40541665c1dfde1bbb (patch)
tree4e186a5f5b2dba36609615a49ff255b6f75f5535 /nixos
parentbd8137aef1a5716e315fdcd8987b22062ffe8eef (diff)
downloadnixpkgs-387f3b58d2cfe131700a3c40541665c1dfde1bbb.tar
nixpkgs-387f3b58d2cfe131700a3c40541665c1dfde1bbb.tar.gz
nixpkgs-387f3b58d2cfe131700a3c40541665c1dfde1bbb.tar.bz2
nixpkgs-387f3b58d2cfe131700a3c40541665c1dfde1bbb.tar.lz
nixpkgs-387f3b58d2cfe131700a3c40541665c1dfde1bbb.tar.xz
nixpkgs-387f3b58d2cfe131700a3c40541665c1dfde1bbb.tar.zst
nixpkgs-387f3b58d2cfe131700a3c40541665c1dfde1bbb.zip
hardware.deviceTree: add name
This can be used to explicitly specify a specific dtb file, relative to
the dtb base.

Update the generic-extlinux-compatible module to make use of this option.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/hardware/device-tree.nix11
-rw-r--r--nixos/modules/system/boot/loader/generic-extlinux-compatible/default.nix3
2 files changed, 13 insertions, 1 deletions
diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix
index 6ae638f17cc..b3f1dda98c8 100644
--- a/nixos/modules/hardware/device-tree.nix
+++ b/nixos/modules/hardware/device-tree.nix
@@ -27,6 +27,17 @@ in {
           '';
         };
 
+        name = mkOption {
+          default = null;
+          example = "some-dtb.dtb";
+          type = types.nullOr types.str;
+          description = ''
+            The name of an explicit dtb to be loaded, relative to the dtb base.
+            Useful in extlinux scenarios if the bootloader doesn't pick the
+            right .dtb file from FDTDIR.
+          '';
+        };
+
         overlays = mkOption {
           default = [];
           example = literalExample
diff --git a/nixos/modules/system/boot/loader/generic-extlinux-compatible/default.nix b/nixos/modules/system/boot/loader/generic-extlinux-compatible/default.nix
index 5ddf96f5790..416f8aeb1d3 100644
--- a/nixos/modules/system/boot/loader/generic-extlinux-compatible/default.nix
+++ b/nixos/modules/system/boot/loader/generic-extlinux-compatible/default.nix
@@ -4,6 +4,7 @@ with lib;
 
 let
   blCfg = config.boot.loader;
+  dtCfg = config.hardware.deviceTree;
   cfg = blCfg.generic-extlinux-compatible;
 
   timeoutStr = if blCfg.timeout == null then "-1" else toString blCfg.timeout;
@@ -53,7 +54,7 @@ in
   };
 
   config = let
-    builderArgs = "-g ${toString cfg.configurationLimit} -t ${timeoutStr}";
+    builderArgs = "-g ${toString cfg.configurationLimit} -t ${timeoutStr}" + lib.optionalString (dtCfg.name != null) " -n ${dtCfg.name}";
   in
     mkIf cfg.enable {
       system.build.installBootLoader = "${builder} ${builderArgs} -c";